title: ActiveRecord where_in() with array
body: <p>I have tried a few different approaches to this problem with no solutions so far. I am receiving this error message:</p>
  
  <p>Unknown column 'Array' in 'where clause'</p>
  
  <p>SELECT * FROM (<code>Articles</code>) WHERE <code>id</code> IN (Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array)</p>
  
  <p>Here is my model code:</p>
  
  <pre><code>function getStarNews($user_id) {
      $this-&gt;db-&gt;select('id');
      $this-&gt;db-&gt;where('user_id', $user_id);
      $query = $this-&gt;db-&gt;get('table1');
  
      foreach ($query-&gt;result_array() as $id)
      {
          //echo $id['id']."&lt;br&gt;"; //displays all of the correct ids I am trying to pass to the where_in()
      }
      $id = $query-&gt;result_array();
  
      $this-&gt;db-&gt;where_in('id', $id); //pass array of 'id' from above query
      $data = $this-&gt;db-&gt;get('Articles');
  
      return $data-&gt;result_array();
  }
  </code></pre>
  
  <p>If I alter the id array to contain only 1 value then the where_in() clause works fine and outputs the row of data matching the single 'id'. </p>
  
  <p>I've looked all over stack and google for help in using where_in() and I think I have everything correct or have tried a few different methods for passing an array correctly. </p>
  
  <p>Thanks for the help.</p>
  
  <p><strong>EDIT:</strong> In the end I will be outputting this data with my controller using:</p>
  
  <pre><code>$this-&gt;output-&gt;set_output(json_encode($data));
  </code></pre>
  
  <p>For testing purposes I was just skipping the JSON and trying to output the data with PHP from the model directly. </p>