Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Cdbcriteria Compare With Value Of 0.

$
0
0
Hello, I am trying to use CDbCriteria()->compare attribute to filter out data. Here is an example of a dropdown, one of my filters use with the name 'numbers'.

0 => "Zero",
1 => "One",
2 => "Two"

So when the user does One or Two, the client sends 1 or 2 respectively to the server where I do something like this.

$criteria = new CDbCriteria();
$criteria->compare('numbers', $this->numbers);


With One or Two, the Grid gets updated and everything works. With Zero nothing is returned, I assume it has something to do with the fact that 0 is also null, so nothing is returned. I need these indexes to stay as is and get 0 to compare correctly.

I would be happy to give any other information you may need to help me. Thank you.

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>