title: Codeigniter3: How to get error or success info from db->insert?
body: <p>I would like to get return info from <code>$CI-&gt;db-&gt;insert(...)</code>, both on success and failure.</p>
  
  <p>I have tried to simply catch the return and echo it and print_r it, but neither gives me anything useful; And I have tried $CI->db->display_errors() (though I did not actually find it listed at <a href="https://www.codeigniter.com/userguide3/database/query_builder.html" rel="nofollow">CI docs</a>).</p>
  
  <pre><code>$return = $this-&gt;db-&gt;insert( "some_table" , $table_data ) ;
  
  print_r( $return  ) ; // 
  // OR
  print  ( $this-&gt;db-&gt;display_errors() ) ;
  </code></pre>
  
  <p>Does <code>$CI-&gt;db-&gt;insert(...)</code> offer a way to check success/failure?</p>
  
  <hr>
  
  <p><strong>UPDATES:</strong> </p>
  
  <p>in CI3 ...</p>
  
  <p><code>$this-&gt;db-&gt;_error_message()</code> generates an error: 
  <code>Fatal error: Call to undefined method CI_DB_mysqli_driver::_error_message()</code> <em>(with or without the leading underscore)</em>.</p>
  
  <p><code>$this-&gt;db-&gt;display_errors()</code> generates an error: <code>Fatal error: Call to undefined method CI_DB_mysqli_driver::display_errors()</code></p>
  
  <p><code>$this-&gt;db-&gt;insert_id()</code> generates a <code>0</code> <em>(regardless of whether the insert succeeds or fails)</em> </p>