displaying tonights performing artist

18 posts by 7 authors in: Forums > CMS Builder
Last Post: February 24, 2012   (RSS)

By rez - March 12, 2010

Just what I needed, thanks. :)

By RGC - February 23, 2012

I am currently using this code to display only upcoming events

<?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 ?
Rod

Re: [rgc] displaying tonights performing artist

By Jason - February 23, 2012

Hi,

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

I tried that, but today's event still does not display .... it will only display if i change the event date to tomorrow
Rod

Re: [rgc] displaying tonights performing artist

By Dave - February 23, 2012

Hi rgc,

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.
Dave Edis - Senior Developer
interactivetools.com

By RGC - February 23, 2012

Thanks for the code Dave, but that did not work, the event dated today did not display .... I am using the following code which appears to work fine, i will just have to check to see that the event gets automatically removed tomorrow (which will be the day after the event). Here is the code i am using:
<?php
list($eventRecords, $eventMetaData) = getRecords(array(
'tableName' => 'event',
'where' => " date >= TIMESTAMP( DATE(NOW() - INTERVAL 1 HOUR) ) ",
));
?>
Rod

By RGC - February 24, 2012

Perfect! This is the code i was looking for:
<?php
list($eventRecords, $eventMetaData) = getRecords(array(
'tableName' => 'event',
'where' => " date >= CURDATE() ",
));
?>

Both events of the current day and future events display. Thanks Dave
Rod