CodeIgniter - how to catch DB errors?

The Solution to CodeIgniter - how to catch DB errors? is


Try these CI functions

$this->db->_error_message(); (mysql_error equivalent)
$this->db->_error_number(); (mysql_errno equivalent)

UPDATE FOR CODEIGNITER 3

Functions are deprecated, use error() instead:

$this->db->error(); 

~ Answered on 2011-10-21 04:17:12


Most Viewed Questions: