title: Multiple where condition codeigniter active record
body: <p>I want to make a multiple where query with <code>AND</code> and <code>OR</code>. Suppose my array is:</p>
  
  <pre><code>array (size=8) 
        0 =&gt; array (size=2) 
                'timeline.type' =&gt; string 'videos' (length=6)                
                'timeline.sourceId' =&gt; string '7' (length=1) 
        1 =&gt; array (size=2) 
                'timeline.type' =&gt; string 'loadshedding' (length=12) 
                'timeline.sourceId' =&gt; string '5' (length=1) 
        2 =&gt; array (size=2) 
                'timeline.type' =&gt; string 'news' (length=4) 
                'timeline.sourceId' =&gt; string '3' (length=1)
        3 =&gt; array (size=2) 
                'timeline.type' =&gt; string 'news' (length=4) 
                'timeline.sourceId' =&gt; string '5' (length=1) 
  </code></pre>
  
  <p>The above array could be dynamic. I want to make active record query like:</p>
  
  <pre><code> (timeline.type = 'videos' AND timeline.sourceId = 7) OR (timeline.type = 'loadshedding' AND timeline.sourceId = 5) OR (timeline.type = 'news' AND timeline.sourceId = 3) // and so on.
  </code></pre>
  
  <p>I tried :</p>
  
  <pre><code> $this-&gt;db-&gt;select('timeline.id as postid, timeline.*, sources.*, subscription.*')-&gt;from('timeline');
   $this-&gt;db-&gt;join('sources', 'sources.type = timeline.type and timeline.sourceId = sources.id');
   $this-&gt;db-&gt;join('subscription', 'subscription.type = timeline.type and timeline.sourceId = subscription.sourceId');
   foreach($sources as $source){   //$sources is an array like given above
          $this-&gt;db-&gt;or_where($source);
   }
   $this-&gt;db-&gt;order_by("timeline.id", "DESC");
   $this-&gt;db-&gt;limit(15);
  </code></pre>
  
  <p>But when I echo <code>$this-&gt;db-&gt;last_query();</code> to see the query. It returns <code>SELECT * FROM timeline</code> only. What might be the problem. Thank you.</p>