Welcome Guest, Not a member yet? Register   Sign In
Logging db errrors to log file but not showing them in the browser
#6

[eluser]Jonny Noog[/eluser]
Further to this issue, I have found that if I have $db['default']['db_debug'] = FALSE; in my database.php file and then run similar test code, but do not use a transaction, like:

Code:
$temp = $this->db->query("INSERT INTO `users` (`foo`) VALUES ('bar')");
if (! $temp)
{
  $err_msg = $this->db->_error_message();
  $err_num = $this->db->_error_number();
            
  log_message('error', 'Database error: ' . $err_msg . 'Error number: ' . $err_num);
  show_error('A database error has occurred.');
  exit();
}

Then everything works as I would have expected. The error gets logged to the log file and the non-descriptive message gets output to the browser. So I can only assume that the problem is to do with the code used for transactions somehow interfering with the return values of _error_message() and _error_number().


Messages In This Thread
Logging db errrors to log file but not showing them in the browser - by El Forum - 06-23-2009, 05:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB