displaying tonights performing artist
18 posts by 7 authors in: Forums > CMS Builder
Last Post: February 24, 2012 (RSS)
By RGC - February 23, 2012
<?php
// load records
list($eventRecords, $eventMetaData) = getRecords(array(
'tableName' => 'event',
'where' => 'date > NOW()',
));
?>
The code works fine displaying only upcoming events, except the day of the event the event does not display! How can i modify this code to display upcoming events including events the same day ?
Re: [rgc] displaying tonights performing artist
By Jason - February 23, 2012
You can change the greater than symbol (>) with greater than or equal to (>=) like this:
<?php
// load records
list($eventRecords, $eventMetaData) = getRecords(array(
'tableName' => 'event',
'where' => 'date >= NOW()',
));
?>
Hope this helps
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] displaying tonights performing artist
By RGC - February 23, 2012
Re: [rgc] displaying tonights performing artist
By Dave - February 23, 2012
Date math can be a bit tricky, I wrote a post about it here:
http://www.interactivetools.com/forum/gforum.cgi?post=78159#78159
What you want is to get the time of the "end of the day". Try replacing NOW() with this:
TIMESTAMP(CURDATE(), "23:59:59")
Let me know if that works for you.
interactivetools.com
By RGC - February 23, 2012
<?php
list($eventRecords, $eventMetaData) = getRecords(array(
'tableName' => 'event',
'where' => " date >= TIMESTAMP( DATE(NOW() - INTERVAL 1 HOUR) ) ",
));
?>
Re: [rgc] displaying tonights performing artist
By Dave - February 23, 2012
Your code will show all events on the current day and forward, except between midnight and 1am, in which case it will show the previous day as well.
That might actually be a useful trick if you expected people would check events after midnight. Or failing that, another way to write it would be like this:
date >= CURDATE()
Good luck!
interactivetools.com
By RGC - February 24, 2012
<?php
list($eventRecords, $eventMetaData) = getRecords(array(
'tableName' => 'event',
'where' => " date >= CURDATE() ",
));
?>
Both events of the current day and future events display. Thanks Dave