I have a Select statement that I want to show only the last 100 records of the database as they are added on an ongoing basis. How do I write the statement? This is my current code. Of course this way i will have to constantly update the > 100 element
Code:
$sql = 'SELECT * FROM `enter` WHERE `id` > 100 ORDER BY `id` ASC';
$result = mysql_query($sql, $dbh)
OR die ($sql . mysql_error());
$count= mysql_num_rows($result);
echo ("<table border='1'>");
echo "<th>ID</th>
<th>IP Address</th>
<th>Date - Time</th>
<th>Page</th>";
WHILE (LIST($id, $address, $date, $page) = mysql_fetch_array($result))
{
echo "<tr>\n" .
"<td>$id</td>\n" .
"<td>$address</td>\n" .
"<td>$date</td>\n" .
"<td>$page</td>\n" .
"</tr>\n";
}
echo "</table>";
?></p>
Thank you