Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

fRecordSet with SQL functions

posted by bonecandy 9 years ago

Looking at the fRecordSet API it looks like I can use SQL functions. Specifically, I'm doing:

$posts = fRecordSet::build('Post',array(
	'DAY(FROM_UNIXTIME(created))='=>$day,
	'MONTH(FROM_UNIXTIME(created))='=>$month,
	'YEAR(FROM_UNIXTIME(created))='=>$year),array('id'=>'desc'),$this->postsPerPage,0);

But I'm always getting this error:

Uncaught exception 'fProgrammerException' with message 'The column specified, DAY(FROM_UNIXTIME(created)), does not exist in the table posts'

And I still get the error even if I don't nest the functions.

Is there something wrong with my syntax? I'm pretty sure I have everything else set up correctly.

Currently only aggregate functions are supported by the where conditions array in fRecordSet::build(). If you need other method calls, you'll need to use fRecordSet::buildFromSql().

posted by wbond 9 years ago