Friday 12 February 2016

Content of student table to HTML

Code:

<?php
echo "<center><h1>Content of student table to HTML</h1>";
$con = mysqli_connect("localhost","root","","studentdb");
$que ="SELECT * FROM student";
$res=mysqli_query($con,$que);
      echo "<table border=1><tr><th>Name of student</th><th>Department of student</th><th>Year of student</th></tr>";
while($disp=mysqli_fetch_assoc($res))
  {
      echo  "<tr><td>".$disp['name']."</td>";
      echo "<td>".$disp['department']."</td>";
      echo "<td>".$disp['year']."</td>";   
      echo "</td></tr>";
  }
  echo "</table></center>";
?>



Output:


No comments:

Post a Comment