จาก Wiki2
<?php
$DBhost = "localhost";
$DBuser = "beingpro_wd";
$DBpass = "******";
$DBname = "beingpro_wd";
$table = "test";
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
mysql_select_db("$DBname") or die("Unable to select databaser name = $DBname");
$sqlquery = "SELECT * FROM $table ORDER BY ID DESC LIMIT 48";
$results = mysql_query($sqlquery);
while ($row = mysql_fetch_array($results))
{
echo $row['id']. " --- ". $row['datetime']." --- ".$row['timestamp']."<br/>";
}
mysql_close();
?>