Try something like:

$time = time(); // unix time now
$day_limit = 28; // how many days to allow

$day = 86400; // how many seconds in 24 hours(1 day)
$difference = bcmul($day_limit,$day); // multiply the seconds($day) by the
day limit($day_limit)
$limit = bcsub($time,$difference);

$sql = mysql_query("delete from table where date<='".$limit."'", $dbh);

Kevin Cawthorne

----- Original Message -----
From: "Thomas Edison Jr." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 21, 2001 12:53 PM
Subject: [PHP] Deleting mySql records based on dates


> How do I delete records from my mySql database which
> are three weeks old?? I will be declaring a date field
> for the records but what coding should I do in order
> to check if the records are three weeks old and then
> erase them so that my data is up to date??
>
> Regards,
> T. Edison jr.
>
> =====
> Rahul S. Johari (Director)
> ******************************************
> Abraxas Technologies Inc.
> Homepage : http://www.abraxastech.com
> Email : [EMAIL PROTECTED]
> Tel : 91-4546512/4522124
> *******************************************
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices!
http://auctions.yahoo.com/
>
> --
> PHP General 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 General 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