Jump to content

Archived

This topic is now archived and is closed to further replies.

umbrella_thing

SQL Query, well, Query...

Recommended Posts

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 date
FROM `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!

Share this post


Link to post
Share on other sites
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'.

Share this post


Link to post
Share on other sites
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!
:-)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.