Addressed to: Nashirak Bosk <[EMAIL PROTECTED]>
              [EMAIL PROTECTED]

** Reply to note from Nashirak Bosk <[EMAIL PROTECTED]> Sat, 03 Feb 2001 
04:05:07 -0500
> 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.

Throw this in to the update program somewhere:

   mysql_query( "DELETE " .
                "FROM table " .
                "WHERE somedate < SUBDATE( NOW(), INTERVAL 30 DAY ) " );

Everything older than 30 days will be deleted.

Rick Widmer
Internet Marketing Specialists

PHP Database Mailing List (
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