Forum Moderators: coopster
I'm having a difficult time to get my query to only show records with dates greater than today. Currently it returns all records in the table. My date format is yyyy-mm-dd. The query i am trying to run is:
SELECT * FROM tbl_events WHERE e_Date_Start >= '" & NOW() & "' and status='Active' ORDER BY e_Date_Start ASC
I've tried using the CURDATE() function and have played around with the operator to see what it going on. It seems like it is just not making the date calculation.
Any assistance is greatly appreciated!
Best regards.
Thanks for your reply and your welcome message. I updated my query with your feedback, but am still having difficulties. I tried using the query, exactly as you had it:
SELECT * FROM tbl_events WHERE e_Date_Start >= '" . date("Y-m-d") . "' and status='Active' ORDER BY e_Date_Start ASC
However, the .(periords) threw and expected end of statement error. So I put the ampersands back in and now have:
SELECT * FROM tbl_events WHERE e_Date_Start >= '" & date("Y-m-d") & "' and status='Active' ORDER BY e_Date_Start ASC
This is throwing the error: rong number of arguments or invalid property assignment: 'Date'
Thanks so much for any assistance you can offer.
Best regards
I think the problem was with & "' NOW() & '" part. You don't need the quotes in this case. NOW() is escaped by default.
Also you said you want greater than today. But your query read >= which in fact is greater or equal. I am not sure if that played any role.