CDbCriteria: find empty string

I have a quite big product database and recently a new field has been added. Tis field is being updated (filled) by the editors manually (it’s a translation). I have also a filter form that uses CDbCriteria to filter fields. Now I want to filter out (to see those fields that have empty string value = not translated).

I’ve used so far

$criteria->compare(‘t.name_hu’, “=”);

$criteria->compare(‘t.name_hu’, “=’’”);

$criteria->compare(‘t.name_hu’, “=’’”, false, ‘AND’, false);

None of the above works…

I know if the field being compared is empty, it will not beadded but there must be a simple solution to match empty text fields. What’s the trick?

PS

Before somebody says "empty text cannot be entered", the $criteria->compare is used in a switch structure like this: for 0 values we dont check empty values, for 1: we check empty values, for 2 we check empty values for more fields

why don’t you just use addCondition?


$criteria->addCondition('t.name_hu = ""');

Thank you very much! Works fine!