Now that we have put info into the database, let's pull it out and do something with it:
1. Create a new page, name it retrieve.php.
2. Study the following code and tweak it so that it works with your page. Copy and paste it into retrieve.php.
<?php
// connect to the sql server
$conn = mysql_connect("localhost", "piper", "coyote");
// pick the database to use
mysql_select_db("info",$conn);
// create the SQL statement
// 'SELECT *' means grab everything
// 'table will be replaced by the name of the table you are using
$sql = "SELECT * FROM table ";
// execute the SQL statement
$result = mysql_query($sql, $conn) or die(mysql_error());
//go through each row in the result set and display data
while ($newArray = mysql_fetch_array($result)) {
// give a name to the fields
$fname = $newArray['fname'];
$lname = $newArray['lname'];
//echo the results on screen
echo "Hello $fname $lname<br>";
}
?>
3. Upload the file and open it in Internet Explorer.