$this->db->trans_start(); $this->db->query('AN SQL QUERY...'); $this->db->update('table',$array); $this->db->trans_complete();  if ($this->db->trans_status() === FALSE) {     // generate an error... or use the log_message() function to log your error }

Read more of this post