Jump to content


Photo

SQL Query, well, Query...


  • Please log in to reply
2 replies to this topic

#1 umbrella_thing

umbrella_thing
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 04 April 2006 - 10:04 AM

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...

SELECT event_name, event_id, event_date, DATE_FORMAT(event_date, '%d/%m %l:%i') as date
FROM `event`
WHERE `event_date` > '$now'
ORDER BY `event_date`, `event_time`
LIMIT 3

I'm sure there is a simple solution for it, could anyone help?

Thanks!

#2 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 04 April 2006 - 12:44 PM

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'.

#3 umbrella_thing

umbrella_thing
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 05 April 2006 - 12:17 AM

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!
:-)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users