View unanswered posts | View active topics It is currently Mon May 23, 2022 12:40 am



Reply to topic  [ 2 posts ] 
 A Simple Select Question 
Author Message
Junior Member

Joined: Fri Jan 05, 2007 8:22 pm
Posts: 12
Post A Simple Select Question
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


Mon Sep 24, 2007 4:08 pm
Report this post
Profile
Junior Member

Joined: Fri Jan 05, 2007 8:22 pm
Posts: 12
Post 
OMG, what was I thinking. I should have seen that a mile away. I tried everything under the sun.

thank you very much friend.


Tue Sep 25, 2007 10:31 am
Report this post
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.