<html>
<head>
<title>Data Display</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><a href="home.php">home</a></p>
<table width="500" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="49"> </td>
<td width="108">name</td>
<td width="44">age</td>
<td width="243">skills</td>
<td width="44"></td>
</tr>
<?
// script to display all the records in a table
// connection information
$hostName = "servername";
$userName = "username";
$password = "password";
$dbName = "dbname";
// make connection to database
mysql_connect($hostName, $userName, $password) or die( "Unable to connect to host $hostName");
mysql_select_db($dbName) or die("Unable to select database $dbName");
// make connection to database
mysql_connect($hostName, $userName, $password) or die( "Unable to connect to host $hostName");
mysql_select_db($dbName) or die("Unable to select database $dbName");
// Select all the fields in all the records of table1
$query = "SELECT * FROM table1 ORDER BY ID";
$result = mysql_query($query);
// Determine the number of employees
$number = mysql_num_rows($result);
// Print the employee names
echo("There are $number employees:<p>");
$i = 0;
While ($i<$number)
{
$ID = mysql_result($result,$i, "ID");
$name = mysql_result($result,$i, "name");
$age = mysql_result($result,$i, "age");
$skills = mysql_result($result,$i, "skills");
?>
<tr>
<td><a href="updateform.php?ID=<?echo("$ID&name=$name&age=$age&skills=$skills");?>">Update</a></td>
<td><?=$name?></td>
<td><?=$age?></td>
<td><?=$skills?></td>
<td><a href="delete.php?ID=<?=$ID?>">Delete</a></td>
</tr>
<?
$i = $i + 1;
}
// Close the database connection
mysql_close();
?>
</table>
</body>
</html>