RE: Mysql Purge script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As well as it assumes that a delete trigger takes care of 
any dependent existences with other rows in other tables.

Secondly, what is the purpose of all assignments below?

-----Original Message-----
From: Ryan Vesely
To: 'Php2tor '; 'php-windows@lists.php.net '
Sent: 3-10-2003 18:35
Subject: RE:  Mysql Purge script

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:B.A.T.Svensson@lumc.nl]
Sent: Friday, October 03, 2003 9:27 AM
To: 'Php2tor '; 'php-windows@lists.php.net '
Subject: RE:  Mysql Purge script


DELETE FROM <table(s)>
WHERE <some-date-attribute-converted-to-days> > <than-30-days>


-----Original Message-----
From: Php2tor
To: php-windows@lists.php.net
Sent: 3-10-2003 18:15
Subject:  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

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux