Damon P Mon Nov 14 13:05:04 -0500 2011

Subject: sparks AR and CI issue Unknown column 'limit' in 'where clause'

I'm using CodeIgniter and AR trying to convert my old site code to AR. I've got the following query setup but get the below error. I'm new to both CI and AR so not sure why it doesn't like what I have. I followed the AR example on setting up this query so not sure if the issue is with SPARKS/CI or AR.

Thanks for any suggestions.

Old query:
$results = $this->Fs_model->search($limit, $offset, $sort_by, $sort_order);

New query:
$results = Fsystem::find('all', array('limit' => 10, 'offset' => 0, 'sort_by'=> 'ostype asc'));

Fatal error: Uncaught exception 'ActiveRecord\DatabaseException' with message '42S22, 1054, Unknown column 'limit' in 'where clause'' in C:\wamp\www\dsp\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\Connection.php on line 312

Ian B Mon Nov 14 14:55:12 -0500 2011

sort_by should be order. If any of the options doesn't use the correct key, PHPAR assumes they're all conditions, which is why it's put the column name "limit" in the where clause.

Damon P Mon Nov 14 15:46:49 -0500 2011

Thank you kindly, that was it not sure how or why I missed that.

Thanks again.