title: CodeIgniter db query not working as expected
body: <p>I am trying to pass parameters from <code>Yii MVC</code> to a <code>CodeIgniter</code> model method and search for results between a time interval;</p>
  
  <p>The <code>created</code> property has values like <code>26/2/2014</code>;</p>
  
  <p>Will the <code>query</code> execute and concat the two <code>where</code> clauses regarding the field <code>created</code> with <code>get_where</code> clause?</p>
  
  <p>Or it will execute only the <code>get_where</code> clause?</p>
  
  <p>I can't see the result, but the <code>created</code> value is being passed;</p>
  
  <p>the <code>created</code> field is stored as a <code>timestamp</code> value in the <code>db</code> and I use a <code>date picker</code> to select the <code>day/month/year</code>, then I pass the value thru the <code>api</code> and then I create the <code>24 hour</code> time interval</p>
  
  <p>and this is where i got stuck;</p>
  
  <p>ps: this is a good example when using <code>EActiveResource</code> instead of <code>ActiveRecord</code> and passing data thru a <code>api</code> built using <code>codeIgniter</code></p>
  
  <pre><code>public function findAll($params) {
          if (!empty($params)) {
              if (isset($params['created'])) {
                  $e = explode('/', $params['created']);
                  $month = $e[1];
                  $day = $e[0];
                  $year = $e[2];
                  $start = mktime(0, 0, 0, $month, $day, $year);
                  $end = mktime(23, 59, 59, $month, $day, $year);
                  $this-&gt;db-&gt;where('created &gt;', $start);
                  $this-&gt;db-&gt;where('created &lt;', $end);
              }
              $query = $this-&gt;db-&gt;get_where($this-&gt;_table, $params);
          } else {
              $query = $this-&gt;db-&gt;get($this-&gt;_table);
          }
          $ret = $query-&gt;result_array();
          foreach ($ret as $key =&gt; $value) {
              $ret[$key]['order_id'] = $value['id'];
          }
          return (isset($ret) &amp;&amp; !empty($ret)) ? $ret : false;
      }
  </code></pre>
  
  <p>I tryed to set the value of <code>$params['created']</code> within <code>yii</code> and pass it to <code>codeIgniter</code> just to make sure I pass the <code>if</code>;</p>
  
  <p>In the <code>codeIgniter</code> model I have:</p>
  
  <pre><code>    if (!empty($params)) {
          if (isset($params['created'])) {
              $this-&gt;db-&gt;where('created &gt;=', 1393246473);
              $this-&gt;db-&gt;where('created &lt;=', 1393404935);
          }
          $query = $this-&gt;db-&gt;get_where($this-&gt;_table, $params);
      } else {
          $query = $this-&gt;db-&gt;get($this-&gt;_table);
      }
      $ret = $query-&gt;result_array();
  </code></pre>
  
  <p>still no data as result;</p>
  
  <p>any ideas?</p>