Jim Lucas wrote:
Terion Miller wrote:
Nobody has asked to confirm, but what format is `stamp`?
Unix Timestamp, MySQL Timestamp, MySQL Date stamp???
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
stamp is a field in the db and I'm using the NOW() to populate it when a
record is created
and when I echo it to my excel sheet it looks like this: 2/24/2009
Problem with that example output is, is that a conversion has happened
somewhere along the way. I say this because the MySQL timestamp format
is YYYY-MM-DD HH:MM:SS. And depending on the full settings will
probably include the GMT offset in there as well. So, your example is bad.
As for saying that you use NOW() to populate it. Well, that says to me
that you at least have something resembling a MySQL timestamp field in
use. So, with that said, here is my rendition of what might work for you.
Here is the example that I lifted from the MySQL doc site:
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
$query .= " WHERE DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= `stamp`";
Try that and let us know your results. */for the archives of course/*
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`";
" WHERE CONVERT(DATE_SUB(NOW(), INTERVAL 7 DAY), DATETIME) <= `stamp`";
also, check these to links out for more information:
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php