Friday, 29 January 2016

Fetch Data in PHP / Get Details from Database / Fetch Information in PHP / While Loop in PHP / Select * from PHP

How can Fetch data in PHP ?
Read data from server in PHP & While Loop in PHP


<?php
include('connection.php');
$table="select * from students";
$query=mysql_query($table);
?>

<table width="400" border="0" cellspacing="0" cellpadding="0">
  <tbody>
 <tr>
      <th  >ID</th>
      <th  >Admission No</th>
      <th  >First Name</th>
      <th  >Last Name</th>
      <th >Mobile 1</th>
    </tr>
     <?php  while($row=mysql_fetch_array($query)) {     ?>
    <tr>
      <td><?php echo $row['pid']; ?></td>
      <td><?php echo $row['admission_number']; ?></td>
      <td><?php echo $row['first_name']; ?></td>
      <td><?php echo $row['last_name']; ?></td>
      <td><?php echo $row['mobile1']; ?></td>
    </tr>
    <?php }?>
  </tbody>
</table>

No comments:

Post a Comment