title: Catchable fatal error: Object of class stdClass could not be converted to string in..when tried to insert into database
body: <p>I have found similar queries like mine in stackoverflow,but found no solutions . So I am asking it again. I have the following <code>insert</code> query :</p>
  
  <pre><code>$purchase_date = date("Y-m-d");
  
      $init = substr($info[fname], 0, 2);
      $odr = rand(0,255);
  
      $invoice_number = $this-&gt;get_invoice_number();
  
      //$invoice_number = $invoice_number+1;
      //$invoice_number = 400 + rand(0,100);
      $order_number = $init.'-'.$odr;
  
  
      $session_id = session_id();
  
      $sql = "
          INSERT INTO
              tbl_checkout
          SET
              fname = '$info[fname]',
              lname = '$info[lname]',
              email = '$info[email]',
              phone = '$info[phone]',
              address = '$info[address]',
              pin = '$info[pin]',
              session_id = '$session_id',
              purchase_date = '$purchase_date',
              invoice_number = '$invoice_number',
              order_number = '$order_number'             &lt;----This is line no 1038
      ";
      $this-&gt;db-&gt;insertQuery($sql);
  </code></pre>
  
  <p>But when I tried to execute it, it shows error like <code>Catchable fatal error: Object of class stdClass could not be converted to string in c:\.....on line 1038</code></p>
  
  <p>I am lost because I can't even understand what the error means ! Please help.</p>