<?php
$username = "root"; //your_name
$password = ""; //your_password
$hostname = "localhost"; //Hostname
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
//select a database to work with
$selected = mysql_select_db("mydatabase",$dbhandle)
or die("Could not select mydatabase");
//execute the SQL query and return records
$result = mysql_query("SELECT * FROM contacts");
//fetch tha data from the database
while ($row = mysql_fetch_array($result)) {
echo "ID:".$row{'contact_id'}." Name:".$row{'contact_first'}."contact_last: ". //display the results
$row{'contact_last'}."<br>";
}
//close the connection
mysql_close($dbhandle);
?>
$username = "root"; //your_name
$password = ""; //your_password
$hostname = "localhost"; //Hostname
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
//select a database to work with
$selected = mysql_select_db("mydatabase",$dbhandle)
or die("Could not select mydatabase");
//execute the SQL query and return records
$result = mysql_query("SELECT * FROM contacts");
//fetch tha data from the database
while ($row = mysql_fetch_array($result)) {
echo "ID:".$row{'contact_id'}." Name:".$row{'contact_first'}."contact_last: ". //display the results
$row{'contact_last'}."<br>";
}
//close the connection
mysql_close($dbhandle);
?>

EmoticonEmoticon