samilo
(Samiloxphp)
1
Hi all
I need to fetch all rows from one table , for example fetch all news without last news .
Controller :
$dataProvider=new CActiveDataProvider('News', array(
'criteria'=>array(
'condition'=>'active=1',
),
'pagination'=>array(
'pageSize'=>10,
),
));
How to do that ?
Thanks in advance
Remove pageSize in pagination or set this value with very large value as 9999999999
samilo
(Samiloxphp)
3
My friend Fabrizio , you didn’t understood my question in clear way , my target fetch all records without last item .
For example :
this is news table
news_id title
1 ssssssss
2 saadsadadsads
3 ssssssssssss
4 sadsadsadsadss
5 wqweqewqwqeqw
6 wwwwwwwwqew
I need to fetch al rows with out item number 6 (last item) - (news_id=6)
Thanks in advance
[b]
[/b]
[b]
[/b]
You could try with this condition:
WHERE … AND id < (SELECT MAX(id) from table)
So
$dataProvider=new CActiveDataProvider('News', array(
'criteria'=>array(
'condition'=>'active=1 AND id < (SELECT MAX(id) FROM news)',
),
'pagination'=>array(
'pageSize'=>10,
),
));