Revision #2 has been created by Mukke on Feb 10, 2011, 11:04:41 AM with the memo:
spelling correction
« previous (#1) next (#3) »
Changes
Title
unchanged
Search method of a model for filters when using dates - unixtimestamp in database
Category
unchanged
Tips
Yii version
unchanged
Tags
unchanged
cdbcriteria model search filter cgridview
Content
changed
[...]
```php
$criteria->condition = ':s<=start AND start<=:e';
$criteria->params=array(':s'=>$daystart,':e'=>$dayend);
```
now because if you put nothing in the date search field of the filter it would result in no records found. This is because and empty date would try to find on a mktime(0,0,0,0,0,0) which results in januar
iey 1st 1970 or something, so unless you have an event that exact date (would seem most unlikely), you will have no results.
tTherefor we would just check if empty before doing the condition, my complete search metho
nd would be something like this( bar the other attributes that can be searched)
```php
public function search()
{[...]