ilikeme
(Eliyaoo12)
1
I’m trying to pagination…
I don’t like YII way then I’m tryign to make one by myself
This is what I’ve done, but it’s not showing any item…
when I delete the limit then it’s show all the items
$page = ($page < 1 || intval($page) != $page) ? 1 : $page;
$per_page = 12;
$start_form = ($page-1)*$per_page;
$items = Item::model()->findAllByAttributes(array('p_catgory'=>$p),array('order'=>'id DESC','limit'=>"$start_form,$per_page"));
softark
(Softark)
2
$items = Item::model()->findAllByAttributes(
array(
'p_catgory'=>$p
),
array(
'order'=>'id DESC',
'offset'=>$start_form,
'limit'=>$per_page,
)
);
But I like Yii way. 
ilikeme
(Eliyaoo12)
4
Ummm and how do I get all the items (MODLE=ITEM) which their p_catgory
is 4 OR 6 OR 9 for example…
Thanks for help 
rootbear
(Alex Xm)
5
try:
$items = Item::model()->findAllByAttributes(
array(),
array(
'condition'=>'p_catgory = :p1 or p_catgory = :p2 or p_catgory = :p3',
'params'=> array(
':p1' => '4',
':p2' => '6',
':p1' => '9',
),
'order'=>'id DESC',
'offset'=>$start_form,
'limit'=>$per_page,
)
);
also: catgory# in sequence 6,4,9 would work better, 