12-24-2009, 07:46 AM
You'll need to write an PHP code for that, first you'll need to connect to the database and then fetch resuls... and show them.
PHP Code:
<?php
$db = array(
'host' => 'localhost', // your host
'user' => 'root', //username
'pass' => '', //password
'base' => 'test' //database name not table
);
// connecting to the database
if($connect = mysql_connect($db['host'], $db['user'], $db['pass'])) {
// selecting the database
if(!$sel = mysql_select_db($db['base'])) {
die("Connection failed..<br />".mysql_error());
}
}
//sql query string
$sql = "SELECT * FROM `people`";
//execute sql query
if(!$query = mysql_query($sql)) {
die(mysql_error()); // die and show error
}
//if mysql_num_rows returns 0 there isn't anything in the table
if(mysql_num_rows($query) <= 0) {
die("There are no entries in the database");
}
//fetch result from the query
while($rows = mysql_fetch_array($query)) {
echo $rows['id']." : ".$rows['name']." : ".$rows['telephone']." : ".$rows['birthday']."<br />";
}
//close connection
mysql_cl($connect);
?>