[nycphp-talk] how do you do date math?
Phil Powell
soazine at erols.com
Sun Oct 5 16:30:14 EDT 2003
Thanx, that was it!
Phil
----- Original Message -----
From: "Hans Zaunere" <hans at nyphp.org>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Sunday, October 05, 2003 11:57 AM
Subject: Re: [nycphp-talk] how do you do date math?
>
>
> Phil Powell wrote:
>
> > I honestly have found nothing on www.mysql.com <http://www.mysql.com> or
> > anywhere else that can address this problem. All I simply want to do is
> > to delete rows from a table where nnet_produkt_record_entered is more
> > than 24 hours old. I thought this would do it but it produces a
> > mysql_error near 'HOURS)':
> >
> > $sql = 'DELETE FROM nnet_produkt_bestilling ' .
> > 'WHERE nnet_produkt_placement < DATE_SUB(NOW(), INTERVAL 24
> > HOURS)';
>
> Close, but your syntax is a little off. Maybe something like:
>
> DELETE FROM nnet_produkt_bestilling
> WHERE nnet_produkt_placement < NOW() - INTERVAL 1 DAY
>
> Although in your text above, you mention nnet_produkt_record_entered so
you may want to check that you're using the correct columns.
>
>
> H
>
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
More information about the talk
mailing list