Where clause not working as would be expected

2 posts by 2 authors in: Forums > CMS Builder
Last Post: October 23, 2009   (RSS)

Hi,

I'm trying to use a custom where clause. A pretty simple one at that and it's not returning any records.

Here is the code:

$mydate=getdate(time());
list($sidebarRecords, $sidebarMetaData) = getRecords(array(
'tableName' => 'daily_specials',
'limit' => '1',
'where' => "title= '".$mydate['weekday'] . "' ",
));

$sidebarRecord=$sidebarRecords[0];


So, today (Friday), this would have an effect of "title= 'Friday'" in the where clause.

I do have a record in the "daily_specials" table with a title of Friday, so this should be picking up that record.

On the line $sidebarRecord=$sidebarRecords[0]; I'm getting an error that [0] is an invalid offset.

Any pointers as to what might be wrong would be helpful.

Thanks,
Gary.