get record from database through PHP
<html>
<body>
<?php
$con=mysql_connect("localhost:3306","root","root");
//echo "$con";
if(!con)
{
die('could not connect'.mysql_error());
}
$sql="select * from department";
mysql_select_db('naveen',$con);
$qry = mysql_query( $sql);
//echo "naveen";
echo "<table border='2'>
<tr>
<th>ID</th><th>NAME</th><th>PASSWORD</th><th>EMAILID</th><th>DELETE</th><th>ERASE</th> </tr>" ;
while($retval=mysql_fetch_array($qry))
{
echo "<tr>";
echo "<td>$retval[0]</td>";
echo "<td>$retval[1]</td>";
echo "<td>$retval[2]</td>";
echo "<td>$retval[3]</td>";
echo "<td><a href='del.php?did=$retval[0]'>delete</a></td>";
echo "<td><a href='up.php?uid=$retval[0]'>update</a></td>";
echo "</tr>";
}
echo "</table>";
?>
</body>
</html>
<body>
<?php
$con=mysql_connect("localhost:3306","root","root");
//echo "$con";
if(!con)
{
die('could not connect'.mysql_error());
}
$sql="select * from department";
mysql_select_db('naveen',$con);
$qry = mysql_query( $sql);
//echo "naveen";
echo "<table border='2'>
<tr>
<th>ID</th><th>NAME</th><th>PASSWORD</th><th>EMAILID</th><th>DELETE</th><th>ERASE</th> </tr>" ;
while($retval=mysql_fetch_array($qry))
{
echo "<tr>";
echo "<td>$retval[0]</td>";
echo "<td>$retval[1]</td>";
echo "<td>$retval[2]</td>";
echo "<td>$retval[3]</td>";
echo "<td><a href='del.php?did=$retval[0]'>delete</a></td>";
echo "<td><a href='up.php?uid=$retval[0]'>update</a></td>";
echo "</tr>";
}
echo "</table>";
?>
</body>
</html>