So I'm rewriting our internal intranet to use the CodeIgniter framework.
Up until now, I've been using $this->db->affected_rows() to determine whether rows were inserted, updated or deleted.
If this method returns TRUE, then I assume the SQL has succeeded. Unfortunately, this fails when no records were updated.
For example, I want to update all records in the database, if there aren't any records which match the where clause, even though the SQL has actually worked, affected_rows() will return FALSE because nothing was updated.
I've looked on Stackoverflow, and people are suggesting to use $this->db->_error_message() and the _error_code() equivalent. From what I've read, to use these functions, I need to turn off DB_DEBUG, which I don't want to do, because I'm still rewriting the intranet on a private server, and want to easily view the error message without trawling through log files.
Is there any way to keep db_debug set to true, and call a method which returns TRUE or FALSE based on whether the query was successful or not?