Can someone please tell me how I can display the latest database entry? Here is the code that I am working with:
require "config.php";
// the latest diary entry
$query = "SELECT * FROM diary_contents LIMIT 1";
if ($r = mysql_query ($query)) {
$str = "";
while ($row = mysql_fetch_array ($r)) {
$str .= '<p>'. $row['selectDay'] . ' ' . $row['selectMonth'] . ' ' . $row['selectYear'] . '<br />' . $row['diary_entry'].
'<br /><a href=diary.php>Click here</a> to see more diary entries.</p>';
}
if($str==="")
{
echo 'No entries to be displayed.';
} else {
echo $str;
}
}
mysql_close();
-- This message may have been cut off and the rest will only be shown to members. To become a member, click here --