This assumes one of the columns on your DB is RecordCreated:
$today = getdate();
$year = $today['year'];
$month = $today['mon'];
$day = $today['mday'];
$hours = $today['hours'];
$minutes = $today['minutes'];
$seconds = $today['seconds'];
$RecordCreated = $year."-".$month."-".$day."
".$hours.":".$minutes.":".$seconds;
$delete_query = "DELETE from $table1 where (TO_DAYS(Now()) -
TO_DAYS(RecordCreated) >= 30));";
$execute_delete = mysql_query($delete_query) or die ("delete failed");
----------------------------------------------------------------
Ryan Vesely
Sales Engineer
Pinnacor
685 Market Street, Suite 500
San Francisco, CA 94105
tel 415.369.4762
fax 415.512.2085
www.pinnacor.com <http://www.pinnacor.com/>
The preceding e-mail message contains privileged, confidential information.
Intended conveyance is only to designated and named recipient(s). If you
feel that you may have received this message in error or if you are not the
named recipient, please notify Pinnacor at once at the sender's email
address, or call 212.691.7900. Unauthorized use, dissemination, distribution
or reproduction of this message is strictly prohibited and may be unlawful.
-----Original Message-----
From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]
Sent: Friday, October 03, 2003 9:27 AM
To: 'Php2tor '; '[EMAIL PROTECTED] '
Subject: RE: [PHP-WIN] Mysql Purge script
DELETE FROM <table(s)>
WHERE <some-date-attribute-converted-to-days> > <than-30-days>
-----Original Message-----
From: Php2tor
To: [EMAIL PROTECTED]
Sent: 3-10-2003 18:15
Subject: [PHP-WIN] Mysql Purge script
Does anyone have a script that will purge a MySQL DB that
has entries over 30 days old?
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php