George: Thanks for that. That's pretty much what I realised anyway, while composing the email. But I thought I'd send it off anyway!
Thanks a lot. Russ :-) -----Original Message----- From: George Pitcher [mailto:[EMAIL PROTECTED]] Sent: Friday, July 05, 2002 2:52 PM To: PHP DB Mailing List (E-mail) Subject: Re: [PHP-DB] SQL prob (DATE_FORMAT) Russ, I'm a bit of a novice, but I would have thought that the DATE_FORMAT function would only work if the field had been defined as a DATE field type. If you are storing the date as an integer eg: 20020705 (today), why not format your current date as a variable based on the same method? That should produce the same results. You only need to format the output but you can do that with PHP. HTH George ----- Original Message ----- From: "Russ" <[EMAIL PROTECTED]> To: "PHP DB Mailing List (E-mail)" <[EMAIL PROTECTED]> Sent: Friday, July 05, 2002 7:33 AM Subject: [PHP-DB] SQL prob (DATE_FORMAT) Hi all: Thanks to Jason for his pointers - whatever the reason though, we need to use INT(10) for our CMS to work! ;-) Anyways... Using our MySQL INT(10) field the following query isn't behaving itself: $event_sql = "SELECT *,DATE_FORMAT('EventDate','%Y-%m-%d') FROM events WHERE EventDate>=CURDATE() ORDER BY EventDate DESC LIMIT 3"; This query should only return those event entries of today's date and any future date right? The MySQL manual points out that: CURDATE() returns dates thus: mysql> SELECT CURDATE(); -> '1997-12-15' (i.e.: with hyphens between the entities in the same format as my DATE_FORMAT() arg's specify above) Can anyone point out why the results of the queries continue to output entries whose dates are prior to the value of CURDATE()? Do these functions depend upon DATETIME, DATE, TITMESTAMP (etc) MySQL field types or what?? Cheers all. Russ Mr Russ Michell Web Applications Developer Itomic.com Email: [EMAIL PROTECTED] Tel: +61 (0)8 9321 3844 Fax: +61 (0)8 6210 1364 Post: PO Box 228, Innaloo, WA 6918, Australia Street: Suite 24, 158 William St, Perth, WA 6000, Australia "No proof of existence is not proof of non-existence." (Physicist: Stanton T. Friedman on Debunking Ufology) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php