Hide past dates
3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 20, 2016 (RSS)
Hi
One of the posts sort of covered off hiding expired dates (that is, only show dates from today onwards), post 2236900 but I must be doing something wrong.
// load records from 'whats_on'
list($whats_onRecords, $whats_onMetaData) = getRecords(array(
'tableName' => 'whats_on',
'orderBy' => 'DATE',
'loadUploads' => true,
'allowSearch' => false,
'where' => 'date' >= TIMESTAMP(CURDATE(), '00:00:00')",
));
That just results in an error. Is this not valid in this circumstance?
By gregThomas - June 20, 2016 - edited: June 20, 2016
Hey degreesnorth,
I think the main issue is that your missing a opening quotation mark:
// load records from 'whats_on'
list($whats_onRecords, $whats_onMetaData) = getRecords(array(
'tableName' => 'whats_on',
'orderBy' => 'DATE',
'loadUploads' => true,
'allowSearch' => false,
'where' => "`date` >= TIMESTAMP(CURDATE(), '00:00:00')",
));
You also need to use a backtick to wrap the date field name (below the escape key) instead of the quotation mark. I've highlighted the characters in red above.
Cheers,
Greg
PHP Programmer - interactivetools.com