Re: PHP query on "date" field
| From: | Bruno Gimenes Pereti | Date: | Tue, 30 Oct 2001 19:47:30 +0000 |
| Subject: | Re: PHP query on "date" field | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-13860@lists.php.net to get a copy of this message | ||
Hi again Jason,
I think Jason Wong got the problem I missed, it's the date format. If you
tested like I sad in the last mail you already found it. When you query:
SELECT * FROM ads WHERE date = '%$date%';
you get an empty result.
So, that's the solution...
Bruno Gimenes Pereti.
> What is the format of date as defined in your database? If date is of
> type DATE or DATETIME then
>
> > $result = mysql_query ("SELECT * FROM ads
> > WHERE fname LIKE '%$fname%' AND lname LIKE
> > '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE
> > '%$phone%' AND
> > date LIKE '%$date%'");
>
> should be changed to:
>
> $result = mysql_query ("SELECT * FROM ads
> WHERE fname LIKE '%$fname%'
> AND lname LIKE '%$lname%'
> AND phonea LIKE '%$phonea%'
> AND phone LIKE '%$phone%'
> AND date = '$date'"
> );