Sunday, February 9, 2014

Php program to retrieve data from the table in database

<?php

// Connects to your Database

mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("emp") or die(mysql_error());
$data = mysql_query("SELECT * FROM emp")
or die(mysql_error());
Print "<table border cellpadding=3>";
while($info = mysql_fetch_array( $data ))

{

  Print "<tr>";
Print "<th>Name:</th> <td>".$info['name'] . "</td> ";
Print "<th>No:</th> <td>".$info['no'] . " </td></tr>";

}

 Print "</table>";

?>









OUTPUT:

No comments:

Post a Comment