RE: [PHP] Making several variables into 1 variable
| From: | Bob McConnell | Date: | Tue, 28 Jul 2009 14:34:37 +0000 |
| Subject: | RE: [PHP] Making several variables into 1 variable | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-295935@lists.php.net to get a copy of this message | ||
From: Miller, Terion
On 7/28/09 8:35 AM, "Ashley Sheridan" <ash@ashleysheridan.co.uk> wrote:
> $pastDays = strtotime("-30 days");
> $date = date("d/m/y", $pastDays);
>
> Well I tried and got no results from my query and I know there
> results with date ranges in the last 30 days, I basically need
> to count backward from now() 30 days I thought strtotime() would
> work well..but the fields in the db are varchar not date fields
> they are all formatted the same though 00/00/00:
If the dates are really stored as varchar, you are doing a lexical
comparison on a field that is meaningless in that context. You will need
to break the string down somewhere and do three separate comparisons.
Bob McConnell