Friday, January 10, 2014

How To Connect To Data Base In PHP

 Sample Code
  


<html>
<body>
<h1> Registration Form</h1>
<table border="1">
<tr>
<th>Reg No</th>
<th>Name</th>
<th>F.Name</th>
<th>Email</th>
</tr>
<?php
mysql_connect("localhost","root","");
mysql_select_db("kiu");
$result=mysql_query("select * from student2");
while ($row =mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" .$row['Reg_no']."</td>";
echo "<td>" .$row['Name']."</td>";
echo "<td>" .$row['FName']."</td>";
echo "<td>" .$row['Email']."</td>";

echo "<tr>";
}
mysql_free_result($result);
mysql_close();
?>
</table>
</body>

</html>

0 comments:

Post a Comment