Re: Deleting mySql records based on dates
| From: | Kevin Cawthorne | Date: | Wed, 21 Feb 2001 13:00:51 +0000 |
| Subject: | Re: Deleting mySql records based on dates | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-40941@lists.php.net to get a copy of this message | ||
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." <thomasedisonjr@yahoo.com>
To: <php-general@lists.php.net>
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 : abraxastech@yahoo.com
> 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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>