Friday, April 18, 2014

Display data of database table on table(html) in PHP.

First create a table in mysql database that contain 2 columns Username and Password than save it.
Now create a php file and write following code in it :-


<table width="50%" border="1">
<tr>
<td><strong><font color="#000000">UserName</font></strong></td>
<td><strong><font color="#000000">Password</font></strong></td>
</tr>

<?PHP
mysql_connect('localhost','root','12345');
mysql_select_db('Mahi');
   
$sql = "SELECT * FROM signup1";
//echo $sql;exit;
   
$result = mysql_query($sql);
while($row=mysql_fetch_array($result))
{
?>

<tr>
<td><?php echo $row['Username']; ?></td>
        <td><?php echo $row['Password']; ?></td>
       
</tr>

<?php
}
?>

Output :-


No comments:

Post a Comment