title: Object of class stdClass could not be converted to string
body: <p>I am using this code to insert</p>
  
  <pre><code>$last_id = "SELECT max(id) as id from clients ";
      $client_id = $this-&gt;db-&gt;query($last_id)-&gt;row();
      $client_last = $client_id-&gt;id;
      $data = array();    
  for($i=0; $i&lt;count($res); $i++)
  {
  $data['user_id'] = $res[$i];
  $data['client_id']=$client_last;
  $this-&gt;db-&gt;insert("notifications", $data);
  }
  </code></pre>
  
  <p>Array <code>$res</code> returns values <code>user_ids</code> like below:</p>
  
  <pre><code> Array
  (
  [0] =&gt; stdClass Object
      (
          [id] =&gt; 5
      )
  
  [1] =&gt; stdClass Object
      (
          [id] =&gt; 6
      )
  
  [2] =&gt; stdClass Object
      (
          [id] =&gt; 7
      )
  
  )
  </code></pre>
  
  <p>And variable <code>$client_last</code> returns single value like <code>5</code> or <code>90</code> something like this.</p>
  
  <p>In this scenario I want to insert three rows in table notifications inserting the value of <code>$res</code> array and same value of <code>$client_last</code> against each value of <code>$res array</code>.
  But in this case I am getting data base error saying:</p>
  
  <blockquote>
    <p>Message: Object of class stdClass could not be converted to string</p>
  </blockquote>
  
  <p>and when I print last query with <code>$this-&gt;db-&gt;last_qery();</code>
  It shows something like this</p>
  
  <pre><code>INSERT INTO `notifications` (`user_id`, `client_id`) VALUES (, '90')
  </code></pre>
  
  <p>with saying sql error.</p>