compare()?" />
V
V
v0lume2015-01-27 19:49:06
Yii
v0lume, 2015-01-27 19:49:06

Yii how to ignore empty attributes (null, "") in $criteria->compare()?

actually, a subject,
for example, I send a form in which not all fields are filled
, then my query string looks like /
activity?
it can be seen that only Activity[responsible_id]=526 is filled, all the rest are empty
when I assign attributes, and then I try to display CGridView (dataProvider=>$model->search()) - empty fields are taken into account in my request, and it does not correctly find data
how to ignore empty fields?
db mysql

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Bay, 2015-01-27
@kawabanga

if (($_POST['param']) and ($_POST['param']!=''))
//add compare

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question