event signup date equal to or greater than now, otherwise do not show event signup

5 posts by 2 authors in: Forums > CMS Builder
Last Post: June 17, 2015   (RSS)

By Dave - June 17, 2015

Hi Zicky, 

Are you just wanting to show events that "have a date equal to or greater than now"?  Or are you wanting to show those AND other events.  Because if it's the first one you can just do the query in your MySQL Where and you don't need to put anything extra in your PHP code to compare dates.  Try this: 

'where' => "registrant_user_number = '". mysql_escape($CURRENT_USER['num']) ."' AND reminder_sent = '0' AND `event_date` >= TIMESTAMP(CURDATE(), '00:00:00')",

Note that I used "TIMESTAMP(CURDATE(), '00:00:00')" instead of NOW() so events without a time specified will always show for the current day (even if you're at 11:00am in the current day and the event has a start time of 00:00:00, which would put the event technically "before" the current time).

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com

By Mikey - June 17, 2015 - edited: June 17, 2015

Correct - events equal to or greater than todays date, including the requirements of the line of code below.

'where' => "registrant_user_number = '". mysql_escape($CURRENT_USER['num']) ."' AND reminder_sent = '0' AND `event_date` >= TIMESTAMP(CURDATE(), '00:00:00')",

Works like a charm! Thanks Dave!

By Dave - June 17, 2015

Ok, great.  So it works? 

Dave Edis - Senior Developer
interactivetools.com

By Mikey - June 17, 2015

Yep - works great.

Thanks for the help with this Dave.

Zick