Re: MySQL/PHP question
| From: | Jeff Gannaway | Date: | Sat, 22 Jul 2000 10:11:37 +0000 |
| Subject: | Re: MySQL/PHP question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7681@lists.php.net to get a copy of this message | ||
At 09:09 AM 7/22/00 -0500, Tyler Longren wrote:
>
>Hello,
>
>Say I have a MySQL table with 32 rows of data. One field is
>auto_incremented. How would I display the 10 most recent additions on a
>page and then have a link going to the 10 entries before? Kinda like a
>guestbook/forum type thing where there's 10 entries or so on a page, you
>hit the next link to go to older entries.
>
>Thanks,
>Tyler Longren
First, in your SELECT query use the ORDER BY DESC paramter:
$query = "select * from MyTable ORDER BY DESC IDField";
For more info see:
http://www.mysql.com/documentation/manual.php?section=SELECT
After you've done that, you know that the first 10 results will always be
the 10 most recent and all the others will not.
Good luck,
Jeff Gannaway