Add Searchcondition Limiting The Result

Hi experts,

I need to LIMIT the results by using LIMIT

im using like this… but i need to LIMIT the results as it is fetching all the results from database…




       $q->addSearchCondition('name',$word,true,"OR");

     	$names = Model::model()->findAll( $q );

I need my query like this…


SELECT * FROM  `table` WHERE name REGEXP  'states' LIMIT 0 , 10



can anyone pls help me to write LIMIT with addSearchCondition

Many Thanks,

see the below link

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

try with limit and offset properties like


$q->offset=0;

$q->limit=10;

before calling findtAll

If work let me know :)

thanks for your reply. Its working…thanks alot


its working only with 

$q->limit=10;



and with


$q->offset=0;

$q->limit=10;