Re: syntax
| From: | Ashley Sheridan | Date: | Tue, 24 Feb 2009 21:20:59 +0000 |
| Subject: | Re: syntax | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-288759@lists.php.net to get a copy of this message | ||
On Tue, 2009-02-24 at 15:15 -0600, 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
> Thanks
> Terion
>
> Happy Freecycling
> Free the List !!
> www.freecycle.org
> Over Moderation of Freecycle List Prevents Post Timeliness.
> ------------------------------------------------
> Twitter?
> http://twitter.com/terionmiller
> ------------------------------------------------
> Facebook:
> <a
> href="http://www.facebook.com/people/Terion-Miller/1542024891"
> title="Terion Miller's Facebook profile" target=_TOP><img src="
>
> http://badge.facebook.com/badge/1542024891.237.919247960.png"
> border=0
> alt="Terion Miller's Facebook profile"></a>
> Vince Lombardi - "Winning is habit. Unfortunately, so is losing."
I think you should look at the date_add function in mysql
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html
they are probably better suited for what you want to do
Ash
www.ashleysheridan.co.uk