Re: syntax
| From: | Terion Miller | Date: | Wed, 25 Feb 2009 13:17:04 +0000 |
| Subject: | Re: syntax | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-288782@lists.php.net to get a copy of this message | ||
>
>>
>> SELECT something FROM tbl_name
>> -> WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= date_col;
>>
>> Taking that and changing it so it works for you would result in the
>> following.
>>
>> $query .= " WHERE DATE_SUB(CURDATE(), INTERVAL 7 DAY) <=
>>
stamp";
>>
>> Try that and let us know your results. */for the archives of course/*
>>
>> Jim Lucas
>>
>>
> Well, looking a little closer, you will need to change a little more. Try
> this instead.
>
> The first should work, but if it doesn't match, try the second.
>
> " WHERE DATE_SUB(NOW(), INTERVAL 7 DAY) <= stamp";
>
> or
>
> " WHERE CONVERT(DATE_SUB(NOW(), INTERVAL 7 DAY), DATETIME) <= z°PÛ@¼þßó�
> ÄTPstamp";
>
> also, check these to links out for more information:
>
>
> http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add
>
> http://dev.mysql.com/doc/refman/5.1/en/cast-functions.html#function_convert
>
Thanks for the suggestions Jim and everyone
I will be trying them today, I realized yesterday that here I was trying to
write date functions to pull records that were within 7 days which doesn't
really work when the db has JUST been created and only has some fake records
I added in it from the the same day..lol...now I'm wondering if I can put
some in and just put in the mySQL timestamp in the "stamp" field myself or
basically change it to reflect older records so I can test the stamp
comparisons ...