I am new to CodeIgniter, PHP and MySQL. I want to handle database errors. From one of the posts on Stackoverflow, I knew that following a statement could catch an error.
$this->db->_error_message();
But I can't figure out the exact syntax for using this. Suppose I want to update table entries with the name "table_name" with the following expression:
$array['rank']="8"; $array['class']="XII"; $this->db->where('roll_no',$roll_no); $this->db->update("table_name", $array);
Here, in the code above, I want to catch a DB error whenever a DB level violation occurs, i.e. either the field name is invalid or there is some unique violation of the constraint. If anyone helps me fix this, I will be very grateful. Thanks.
source share