Query-> limit problem


(Demonroom) #1

I’d like to run SQL query “select * from member limit 20,5”

How to run it in Yii???

I’ve tried this:




$cri=new CDbCriteria;

$cri->limit=20,5;

$query=member::model()->findall($cri);



But it returned with error code…

Need help, please…


(Maurizio Domba Cerin) #2

Haven’t used yet, but try with:




$cri->offset=20;

$cri->limit=5;



offest detail - http://www.yiiframework.com/doc/api/CDbCriteria#offset-detail

limit detail - http://www.yiiframework.com/doc/api/CDbCriteria#limit-detail


(Demonroom) #3

It worked… :lol:

Thanks, mdomba… ;D