Re: syntax

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

 



Micah Gersten wrote:
Martin Zvarík wrote:
Chris napsal(a):
Terion Miller wrote:
Need syntax help when it comes to using a timestamp.
What I'm trying to say in my query WHERE clause is to select records
if the
timestamp on the record is in the past 7 days from NOW()

$query .= " WHERE stamp < NOW()-7 ";  I have no clue here on this ....

the lay language is  WHERE stamp is within the past 7 days.... how
to php
that? lol
Has nothing at all to do with php.

http://dev.mysql.com/doc/refman/5.0/en/datetime.html
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

$query .= " WHERE stamp < ".(time()-7*3600*24);

Using something like that is disastrous for DST and Leap Seconds...

It was a dig at me for saying it's not php related ;)

(Learning sql still has nothing to do with php).

--
Postgresql & php tutorials
http://www.designmagick.com/


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux