Hello I have the code
$allLogins = IpAddressLogin::model()->findAllByAttributes(
array(
'user_id' => Yii::app()->user->id,
'type' => 'user'
),
array(
'order' => 'date desc',
'limit' => '15, 10',
));
I want to get 10 records from number 15 record. But It just gives me only the last 15 records.
It parses only the first number(15) in 'limit'. How can I set LIMIT 15, 10 in findAllByAttributes?
You should use offset for it. Please have a look on below code it will help you to set required limit
$allLogins = IpAddressLogin::model()->findAllByAttributes(
array(
'user_id' => Yii::app()->user->id,
'type' => 'user'
),
array(
'order' => 'date desc',
'limit' => 10,
'offset' => 15
));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With