Re: syntax

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

 



On Wed, 2009-02-25 at 07:17 -0600, Terion Miller wrote:
> >
> >>
> >> 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) <= `stamp`";
> >
> > 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 ...
Yes you can. I tend to just use phpMyAdmin for stuff like that, as it's
generally quicker to fire that up than write a script and run it!


Ash
www.ashleysheridan.co.uk


-- 
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