Difference between #1 and #2 of
Search method of a model for filters when using dates - unixtimestamp in database

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 an
d empty date would try to find on a mktime(0,0,0,0,0,0) which results in januariey 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 methond would be something like this( bar the other attributes that can be searched)

```php
public function search()
{
[...]
10 0
11 followers
Viewed: 38 167 times
Version: 1.1
Category: Tips
Written by: Mukke
Last updated by: jwerner
Created on: Feb 10, 2011
Last updated: 13 years ago
Update Article

Revisions

View all history