// Get data from Mysql DataBase in PHP (Display in Table)
<?php
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("bnr");
$sql="select *from reg";
$query=mysql_query($sql);
echo "<table border='1'>
<tr>
<th>User Name</th>
<th>Name</th>
<th>password</th>
<th>Emp ID</th>
<th>Phone No</th>
<th>Email ID</th>
<th>Address</th>
</tr>";
while($row = mysql_fetch_array($query))
{
$username=$row['username'];
echo "<tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['password'] . "</td>";
echo "<td>" . $row['emp_id'] . "</td>";
echo "<td>" . $row['phone_no'] . "</td>";
echo "<td>" . $row['email_id'] . "</td>";
echo "<td>" . $row['address'] . "</td>";
echo "</tr>";
}
mysql_close($con);
?>
</table>
<?php
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("bnr");
$sql="select *from reg";
$query=mysql_query($sql);
echo "<table border='1'>
<tr>
<th>User Name</th>
<th>Name</th>
<th>password</th>
<th>Emp ID</th>
<th>Phone No</th>
<th>Email ID</th>
<th>Address</th>
</tr>";
while($row = mysql_fetch_array($query))
{
$username=$row['username'];
echo "<tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['password'] . "</td>";
echo "<td>" . $row['emp_id'] . "</td>";
echo "<td>" . $row['phone_no'] . "</td>";
echo "<td>" . $row['email_id'] . "</td>";
echo "<td>" . $row['address'] . "</td>";
echo "</tr>";
}
mysql_close($con);
?>
</table>
<html>
<head></head>
<body>
</body>
</html>
No comments:
Post a Comment