DISPLAY DATA FROM DATABASE TABLE BY PHP

DISPLAY DATA FROM DATABASE TABLE BY PHP 

DISPLAY DATA FROM EMP TABLE

( retrieve.php)

<?php

include_once 'database.php';

$result = mysqli_query($con,"SELECT * FROM emp");

?>

<!DOCTYPE html>

<html>

 <head>

 <title> Retrive data</title>

           <link rel="stylesheet" href="style.css">

 </head>

<body>

          <div align="center">EMPLOYEE DETAILS </div>

          <div style="padding-bottom:5px;">

<a href="insert.php">Insert Employee Record</a>

                    &nbsp;&nbsp;

<a href="update.php">Update Employee Record</a>

                    &nbsp;&nbsp;

                    <a href="delete.php">Delete Employee Record</a>

     </div>

<?php

if (mysqli_num_rows($result) > 0) {

?>

  <table>

             <tr>

    <td>Emp No</td>

                    <td>Emp Name</td>

                    <td>Father Name</td>

                    <td>City</td>

  </tr>

<?php

$i=0;

while($row = mysqli_fetch_array($result)) {

?>

<tr>

    <td><?php echo $row["eid"]; ?></td>

          <td><?php echo $row["ename"]; ?></td>

    <td><?php echo $row["fname"]; ?></td>

    <td><?php echo $row["city"]; ?></td>

   </tr>

<?php

$i++;

}

    ?>

  </table>

 <?php

}

else{

    echo "No result found";

}

   ?>

 </body>

</html>





Post a Comment

0 Comments