Assuming one of the fields in the row of timedate type, you can just do

DELETE FROM table WHERE datefield BETWEEN #date# AND #otherdate#

#date# can be something old like 1980-01-01 and #otherdate# is simply 28
dayes ago...

See mktime()

Siggy

----- Original Message -----
From: "Nashirak Bosk" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 03, 2001 10:05 PM
Subject: [PHP-DB] Garbage Collection


>   I am writing a PHP script that accesses a MYSQL database when the
> adminstrator (the client) wants to add something to a calendar
> (dynamically PHP generated).  I have written the callendar and have the
> whole thing setup to be able to update it regularly, through a easy user
> interface on the adminstration page.  The problem that I am forseeing
> though is that, the person I am doing this for is going to keep adding
> information to the calendar thereby adding more rows to the database,
> and never deleting any of it.  Since this is a calendar, I thought I
> might right some sort of "Garbage Collector" deletes old information on
> the first of the month.  The way I would have to do this though, is it
> to go through all the fields, parse the Date field, and check to see if
> the date is less than the current.  My question is, is there a faster
> way to do this.  Mabye some MYSQL built in function that I am missing or
> something.  Any help would be appreciated.
>
>
> --
> -------------------------------------
>
>  Clayton Bluhm
>  Computer Engineering Student
>
>  Email:
>
>  [EMAIL PROTECTED] (home)
>  [EMAIL PROTECTED] (school)
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to