title: CodeIgniter search results are unexpected; where() with or_like() broken?
body: <ul>
  <li><p>Today's date is April 25, 2013.  Yes, the time on the server is correct and a <code>var_dump</code> of <code>mdate('%Y-%m-%d', strtotime(now()))</code> is returning <code>2013-04-25</code>.</p></li>
  <li><p>The MySQL table column for <code>date</code> is the <code>date</code> type/format.</p></li>
  <li><p>CodeIgniter 2.1.3</p></li>
  <li><p>My search criteria string is <code>"test"</code>.</p></li>
  </ul>
  
  <p>&nbsp;</p>
  
  <pre><code>$criteria = array(
      'field1' =&gt; 'test',
      'field2' =&gt; 'test',
      'field3' =&gt; 'test'
  );
  </code></pre>
  
  <hr>
  
  <p>The four items in my database that contain the word "test" are dated as follows:</p>
  
  <pre><code>date
  2013-04-02
  2013-04-05
  2013-05-07
  2013-05-21
  </code></pre>
  
  <hr>
  
  <p>In my model, when I want my search results (search = "test") to return everything no matter what the date, this is what it looks like...</p>
  
  <pre><code>$this-&gt;db-&gt;start_cache();       
  $this-&gt;db-&gt;or_like($criteria);
  
  $this-&gt;db-&gt;order_by('date', 'desc');
  
  $this-&gt;db-&gt;stop_cache();        
  $query['results'] = $this-&gt;db-&gt;get('table', $limit, $offset)-&gt;result_array();       
  $this-&gt;db-&gt;flush_cache();       
  return $query;
  </code></pre>
  
  <p>output as expected:</p>
  
  <pre><code>2013-05-21
  2013-05-07
  2013-04-05
  2013-04-02
  </code></pre>
  
  <p>The above is working perfectly and all four items are returned.</p>
  
  <hr>
  
  <p>However, when this is used and only a <code>where()</code> is added to refine the results to today and greater...</p>
  
  <pre><code>$this-&gt;db-&gt;start_cache();   
  $this-&gt;db-&gt;or_like($criteria); // &lt;-- remove this line and it works
  
  $this-&gt;db-&gt;where('date &gt;=', mdate('%Y-%m-%d', strtotime(now()))); // &lt;-- only new line
  
  $this-&gt;db-&gt;order_by('date', 'asc');
  
  $this-&gt;db-&gt;stop_cache();    
  $query['results'] = $this-&gt;db-&gt;get('table', $limit, $offset)-&gt;result_array();   
  $this-&gt;db-&gt;flush_cache();   
  return $query;
  </code></pre>
  
  <p><strong>unexpected</strong> output:</p>
  
  <pre><code>2013-04-02 // &lt;-- why this one??? today is 4/25
  2013-05-07
  2013-05-21
  </code></pre>
  
  <p>It's supposed to only show the results for today and in the future.  <strong>So why is the item dated April 2, 2013 in there when today is April 25, 2013?</strong>  (It's like it's partially working because it's still ignoring the item with <code>2013-04-05</code>.)</p>
  
  <ul>
  <li>why is this happening?</li>
  <li>how to fix this?</li>
  </ul>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>I've tried reversing the order:</p>
  
  <pre><code>$this-&gt;db-&gt;where('date &gt;=', mdate('%Y-%m-%d', strtotime(now())));
  $this-&gt;db-&gt;or_like($criteria);
  </code></pre>
  
  <p>and chaining:</p>
  
  <pre><code>$this-&gt;db-&gt;or_like($criteria)-&gt;where('date &gt;=', mdate('%Y-%m-%d', strtotime(now())));
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>$this-&gt;db-&gt;or_like($criteria);
  $this-&gt;db-&gt;where('DATE(date) &gt;= DATE(NOW())');
  </code></pre>
  
  <p>Results are the same.</p>