title: How to insert records using select active records in codeigniter
body: <p>I found some questions same with this issue but i can't seem to find a right answer for my own code. so i'm going to post my problem. </p>
  
  <p>my code is not working and posting errors. like "stdClass could not be converted to string" or problem regarding to array.</p>
  
  <p>here's my code in model</p>
  
  <pre><code>$this-&gt;db-&gt;select("*");
  $this-&gt;db-&gt;from("table1");
  $query = $this-&gt;db-&gt;get();
  $this-&gt;db-&gt;insert("table2", $query-&gt;result());
  </code></pre>
  
  <p>this is not working.</p>
  
  <p>now when i use print_r($query) the result is this.</p>
  
  <pre><code>CI_DB_mysql_result Object ( [conn_id] =&gt; Resource id #30 [result_id] =&gt; Resource id #40 [result_array] =&gt; Array ( ) [result_object] =&gt; Array ( ) [custom_result_object] =&gt; Array ( ) [current_row] =&gt; 0 [num_rows] =&gt; 5 [row_data] =&gt; )
  </code></pre>