I have the code below and when I try to open the page I get the message
"; } // Close the database connection mysql_close($con); ?>
As you can see I closed it. Can someone please help me. Thanks.
<html>
<head>
<title>Retrieve data from database </title>
</head>
<body>
<?php
$host='localhost';
$user='xxxxx';
$pass='xxxxx';
$database='xxxxx';
// Connect to database server
$con=mysql_connect($host, $user, $pass) or die (mysql_error ());
// Select database
mysql_select_db($database) or die(mysql_error());
// SQL query
$strSQL = "SELECT * FROM contact_list";
// Execute the query (the recordset $rs contains the result)
$rs = mysql_query($strSQL);
// Loop the recordset $rs
// Each row will be made into an array ($row) using mysql_fetch_array
while($row = mysql_fetch_array($rs)) {
// Write the value of the column LastName (which is now in the array $row)
echo $row['lastname'] . "<br />";
}
// Close the database connection
mysql_close($con);
?>
</body>
</html>