Re: Date problem
| From: | Miles Thompson | Date: | Sun, 21 Jan 2007 23:58:24 +0000 |
| Subject: | Re: Date problem | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-42965@lists.php.net to get a copy of this message | ||
At 12:26 PM 1/21/2007, Denis L. Menezes wrote:
Dear friends. I have a date field in mysql called event_end . I want to run a query to find all records where the event_and is greater than today's date. I have written the following code. It does not work. Please point out the mistake. $today = getdate(); $sql="select * from events where event_end>'.$today.' order by event_start Asc "; Thanks denisHow is your date formatted in the database. Compare that to the format returned by getdate(), then consider using date('Y-m-d'). That's assuming your MySQL date is stored as yyyy-mm-dd. Nonetheless, this should set you on the right road. It would also have helped your diagnosis if you echoed your SQL statement. Cheers - Miles Thompson -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.410 / Virus Database: 268.17.3/642 - Release Date: 1/20/2007