Albin
(Albin Xvan)
1
code:
$criteria = new CDbCriteria;
$criteria->select = 'cat_id,cat_name';
$criteria->condition = 'parent_id=0';
$criteria->order = 'cat_id ASC';
$cates = Category::model()->findAll($criteria);
but return array(0){}
appreciate for your any answer.
samdark
(Alexander Makarov)
2
What are you expecting to see?
Albin
(Albin Xvan)
3
empty array here. I want to return the array of categories with columns of cat_id and cat_name.
samdark
(Alexander Makarov)
4
Are you sure you have categories with parent_id=0?
Albin
(Albin Xvan)
5
Thank for samdark’s help. I’ve had an answer to the question.
$criteria->condition = ‘parent_id=0’ is error.