The reason I used that route was to show the logic.

Yes its long- some people may not want a mysql reliant way of doing it.

Kevin 

----- Original Message ----- 
From: "Christian Reiniger" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 21, 2001 1:11 PM
Subject: Re: [PHP] Deleting mySql records based on dates


> On Wednesday 21 February 2001 14:00, Kevin Cawthorne wrote:
> 
> > 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);
> 
> Eeeek. Have a look at the Mysql manual sometime soon!
> 
> $sql = mysql_query("delete from table where datefield <= DATE_SUB(NOW(), 
> INTERVAL $days DAY)", $dbh);
> 
> -- 
> Christian Reiniger
> LGDC Webmaster (http://sunsite.dk/lgdc/)
> 
> "These are the people who proudly call themselves "hackers" --
> not as the term is now abused by journalists to mean a computer
> criminal, but in its true and original sense of an enthusiast,
> an artist, a tinkerer, a problem solver, an expert."
> 
> - ESR
> 
> -- 
> 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