Answer the question
In order to leave comments, you need to log in
Why doesn't CDbCritaria fulfill more than one condition in Yii?
$criteria = new CDbCriteria();
This option works:
This one works too
But this one doesn't, returns an empty result, although there are definitely values in the table that satisfy the WHERE condition$criteria->condition = " `LEVEL` = '2'";
$criteria->condition = " `EXIST` = '1'";
$criteria->condition = " `LEVEL` = '2' AND `EXIST` = '1' ";
$ob = Service::model()->findAll($criteria);
SELECT * FROM `t_service` `t` WHERE `LEVEL` = '2' AND `EIST` = '1'
Answer the question
In order to leave comments, you need to log in
$criteria->condition
overwrites the previous condition and sets a new one, you need to use
$criteria->addCondition()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question