Hi, thanks for the reply. Here is a copy of my working code could you help me out I am new to PHP so I hardly know what I am doing. Can you explain your code in more detail to me. Thanks.
This is the webpage that gets the information loaded from the MySQL database
<?php
//variables for database and table
$table_name="staff";
//quering the database
require("phpinclude.php");
$sql = "SELECT * FROM " .$table_name. " ORDER BY lname";
$results = @($sql, $connection) or die(mysql_error());
//database array
while ($row=mysql_fetch_array($results))
{
$lname=$row[lname];
$fname=$row[fname];
$email=$row[email];
$phone=$row[phone];
$room=$row[room];
$picture=$row[picture];
$id=$row[id];
$department=$row[department];
$display_block= $display_block .
"
<p><a href='formpage2.php?id=".$id."'><img src='database/".$picture."'/></a>
<br />
".$fname." ".$lname."
<br /><strong>".$department."</strong>
<br />ph.".$phone."
<br />Rm.".$room."
</p>"
;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php echo $display_block; ?>
</body>
</html>
This is the connection to the database page
<?
//database name
$db_name="Database1";
//connect to MySQL and select manit
$connection=mysql_connect("", "", "") or die(mysql_error());
$db=@mysql_select_db($db_name, $connection) or die(mysql_error());
?>