Future dates only...

3 posts by 2 authors in: Forums > CMS Builder
Last Post: September 16, 2013   (RSS)

By HDLLC - September 16, 2013

Hi there -

I first did some searching to find a solution, but so far, nothing seems to work/apply.

http://www.interactivetools.com/forum/forum-posts.php?postNum=2218781

Discusses something similar.  I'm using a calendar type display, along with a text display version as well.

I only want that text version to display events that are in the future.  Sort of make it a little more self-managing so we don't have old stuff on there every day, and can edit as we have time.

This is my code:

// load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/home/warsaw/public_html/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

//Get the current date in SQL date format
  $date = date('Y-m-d 00-00-00');

  // load records from 'events'
  list($eventsRecords, $eventsMetaData) = getRecords(array(
    'tableName'   => 'events',
    'perPage'     => '10',
    'loadUploads' => true,
    'allowSearch' => false,
    'orderBy'     => 'start_date ASC',
//  'where'       => "date >= '$date'",
  ));

That where clause is commented out because it's throwing an error.

If anyone has ideas, please let me know!

Thanks much!

--Jeff

By Jason - September 16, 2013

Hi Jeff,

When you uncomment out the where option, what is the error you get?

My first thought would be that we should be using the start_date field instead of just date:

 'where'       => "start_date >= '$date'",

Does this work?  Please let me know if you have any other questions.

Thanks

---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/