Re: PHP Help
| From: | Torsten Roehr | Date: | Fri, 03 Sep 2004 08:47:19 +0000 |
| Subject: | Re: PHP Help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-195700@lists.php.net to get a copy of this message | ||
"Conbud" <conbudd@yahoo.com> wrote in message
news:20040903023515.102.qmail@pb1.pair.com...
> Hey, Im making a site to where I can fill out a form and it adds updates
to
> the main page, but I only want the site to display 5 updates on it, now I
> know how to make it only show 5 updates, but then that means when a new
> update is posted to the site, it just stores the old updates in the
database
> and over time this can make the database quite large, How would I make it
> delete the oldest update and just add the newest update to the top of the
> list ? So this way I only have 5 updates stored in the database at all
> times.
>
> Thanks
> ConbuD
Insert your new item, then delete the oldest one:
DELETE FROM table ORDER BY date asc LIMIT 1
Whereas 'date' is your date column.
Regards, Torsten Roehr