RE: [PHP] get current events from mysql query by date?
| From: | php3 at developersdesk dot com | Date: | Mon, 05 Mar 2001 21:53:41 +0000 |
| Subject: | RE: [PHP] get current events from mysql query by date? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-42676@lists.php.net to get a copy of this message | ||
Addressed to: <jeff@webdesigns1.com>
php-general@lists.php.net
** Reply to note from <jeff@webdesigns1.com> Mon, 5 Mar 2001 14:10:28 -0600
>
> This is just a guess but wanted to take a shot at it.
>
> Something like
>
> SELECT EventID, EventName, EventDescription,
> EventStartDate, EventEndDate
> WHERE EventStartDate > CURRENT_DATE
> ORDER BY EventStartDate ASC
> LIMIT 5;
>
> How did I do?
Close, very close. I belive CURRENT_DATE is a MySQL function. MySQL
functions are identified by not having a space between the function name
and the required ( that makes it a function. If CURRENT_DATE is
actually a function (I use NOW() because it is shorter) then you need to
change the WHERE clause to:
WHERE EventStartDate > CURRENT_DATE()
If CURRENT_DATE() is not a valid function change it to:
WHERE EventStartDate > NOW()
Both assume that EventStartDate is a MySQL DATE, DATETIME or TIMESTAMP
value. If they are something else, this will not work. It should be
one of these types though!!!
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com