0

I have a database with a listing of events. I do not want to include events that have already happened, so I want to query the db for events from the current date going forward. I have tried a number of things but it is not working. Here is what i have so far - in the query

// Get the current date
$Now = time(); 
 
// Make a MySQL Connection
mysql_connect("localhost", "*****", "****") or die(mysql_error());
mysql_select_db("******") or die(mysql_error());

// Get all the data from the table


$result = mysql_query("SELECT * FROM events where Date > $Now order by Date ASC Limit 0,10")
or die(mysql_error());

Any help would be appreciated.
Cheers,
Chris

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by ceeandcee
1

try this:

SELECT * FROM events WHERE field3 >= DATE(NOW());

so, all in all from what you have:

// Make a MySQL Connection
mysql_connect("localhost", "*****", "****") or die(mysql_error());
mysql_select_db("******") or die(mysql_error());
// Get all the data from the table
$result = mysql_query("SELECT * FROM events WHERE field3 >= DATE(NOW());")
or die(mysql_error());

Edited by design324095: n/a

0

Awesome! I tweaked my order by clause and it is all good. Does exactly what I need it to. Thanks so much!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.