Wednesday 24 April 2013

Retrieve data from XAMPP and show in table format-php


<?php
$con=mysqli_connect("localhost","root","","Occumen");
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
$result = mysqli_query($con,"SELECT * FROM empinfo");
echo "<table border='5'>
<tr>
<th>EmployeeNum</th>
<th>EmployeeName</th>
<th>EmployeeSalary</th>
</tr>";
while($row = mysqli_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['eno'] . "</td>";
  echo "<td>" . $row['ename'] . "</td>";
   echo "<td>" . $row['esalary'] . "</td>";
  echo "</tr>";
  }
echo "</table>";
mysqli_close($con);
?>

No comments: