umbrella_thing Posted April 4, 2006 Share Posted April 4, 2006 Hi guys,I'm designing a website that involves events that happen on a certain date.Now, I don't want to show the old events on my site so I made this query...But I want to show the next 3 upcoming events...[code]SELECT event_name, event_id, event_date, DATE_FORMAT(event_date, '%d/%m %l:%i') as dateFROM `event`WHERE `event_date` > '$now'ORDER BY `event_date`, `event_time`LIMIT 3[/code]I'm sure there is a simple solution for it, could anyone help?Thanks! Link to comment https://forums.phpfreaks.com/topic/6557-sql-query-well-query/ Share on other sites More sharing options...
wickning1 Posted April 4, 2006 Share Posted April 4, 2006 That should work, what is the problem you are having? The only suggestion I can make right now is to use the MySQL function NOW() instead of doing it in PHP like you are doing with '$now'. Link to comment https://forums.phpfreaks.com/topic/6557-sql-query-well-query/#findComment-23797 Share on other sites More sharing options...
umbrella_thing Posted April 5, 2006 Author Share Posted April 5, 2006 Yes that worked well,I was using $date with PHP's date function.NOW() is much better, but apparently not the problem, and the SQL wasn't the problem!!Thanks heaps anyway!:-) Link to comment https://forums.phpfreaks.com/topic/6557-sql-query-well-query/#findComment-24027 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.