Re: Garbage Collection
| From: | phobo | Date: | Sat, 03 Feb 2001 09:12:22 +0000 |
| Subject: | Re: Garbage Collection | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-6338@lists.php.net to get a copy of this message | ||
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" <nashirak@mindspring.com>
To: <php-db@lists.php.net>
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:
>
> nashirak@mindspring.com (home)
> gte501v@prism.gatech.edu (school)
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>