Re: Re: code not working...help?
| From: | Matthew Sims | Date: | Fri, 08 Oct 2004 05:53:04 +0000 |
| Subject: | Re: Re: code not working...help? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198933@lists.php.net to get a copy of this message | ||
> i just realized that the dates in the database are saved as
> varchar (althought they are numbers) is there anyway to compare the
> $lastmonth value (which returns as a 14 digit number) to that because
> the
> way i have it now with
>> post_date <= '$lastmonth'
> wont work because post_date is varchar and $lastmonth is an interger
> right?
>
>
>
Have you thought about using MySQL's datetime rather than creating your own?
http://dev.mysql.com/doc/mysql/en/DATETIME.html
You have $lastmonth as YYMMddHHmmss.
Why not do it as YY-MM-dd HH:mm:ss, like:
$lastmonth = date("Y-m-d H:i:s", mktime(date("H"), date("i"),
date("s"),
date("m")-1, date("d"), date("Y"));
MySQL will suck it up much better that way.
--
--Matthew Sims
--<http://killermookie.org>