In almost in every wiki simple things are explained. I'm stuck in yii's CDbcriteria
compare issue.
Only the exact "equal to" match is explained for:
select * from users where status ='active'
This comparison is explained:
$criteria->compare('status','active');
But I can't find an example script which describes it with an operator based search. Like not equal to for the following query:
select * from users where status !='active'
How can I do this?
try some thing like this
$criteria->condition = " status<>'active'";
$criteria->compare('status',$this->status,true);
$criteria->addNotInCondition('status', array('active'));
if count(array('active')) === 1
sql will status != 'active'
, else status NOT IN ('active', 'smth else')
Try
$criteria->addCondition("NOT status = 'active'");
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