How can I make the query ask for all future dates instead of today?

679 Views Asked by At

I'm wanting to change the mySQL request to ask for all events in the database from today onward. Right now it is just asking for all events only on thdays date. This is what I have:

  $query  =  "SELECT * FROM events WHERE date(convert_tz(StartDate,'+00:00','". $numric_time."'))='$currentDate' AND UserID='" . $_SESSION['userData']['UserID'] ."' ORDER BY StartTime"; //getting date's agendas

Thanks!

1

There are 1 best solutions below

3
On
SELECT *
FROM events
WHERE StartDate >= CURDATE()
    AND...

If you need the timezone offset, change the query to use CURDATE() +/- INTERVAL x HOUR, wrapping the StartDate in a function such as CONVERT_TZ causes MySql not to use any index on that column.