"Conbud" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to