title: Codeigniter - Limit items in query "where_in"
body: <p>I would like limiting the results for every id (only 3 results for array id).</p>
  
  <p>If I add:</p>
  
  <pre><code>$this-&gt;db-&gt;limit(3);
  </code></pre>
  
  <p>I receive three records in total; but I want 3 record for every id.</p>
  
  <p>How can I do?</p>
  
  <pre><code>&lt;?php
  
  $array = array('id' =&gt; 1, 'id' =&gt; 2, 'id' =&gt; 3);
  
  class Your_model extends CI_Model
  {
      public $db;
      public function __construct()
      {
         parent::__construct();
         $this-&gt;db = $this-&gt;load-&gt;database('default',true);     
      }
  
      public function function_name()
      {
          $this-&gt;db-&gt;select('file_name');
          $this-&gt;db-&gt;from('images_table');
          $this-&gt;db-&gt;where_in('id', $array);            
          $query = $this-&gt;db-&gt;get();                  
  
          $result = "";
          if($query-&gt;num_rows() &gt; 0)
              $result = $query-&gt;result_array();
          else
              $result = "No result";
  
          print_r($result);
      }
  }
  </code></pre>