Redirect all database errors to error log unless $go_debug is switched on.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 25 Apr 2014 22:12:09 +0000 (00:12 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 21 May 2014 12:23:16 +0000 (14:23 +0200)
includes/errors.inc

index 08a5e5781f6b6e421e087181b0709df02723b08e..e59e14b059294715b172ca9775ca010bd1320d8e 100644 (file)
@@ -195,10 +195,14 @@ function display_db_error($msg, $sql_statement=null, $exit=true)
        }
        
        $str .= "<br><br>";
-       if($msg)
-               trigger_error($str, E_USER_ERROR);
-       else    // $msg can be null here only in debug mode, otherwise the error is ignored
-               trigger_error($str, E_USER_WARNING);
+       if ($go_debug)
+               error_log($str);
+       else {
+               if($msg)
+                       trigger_error($str, E_USER_ERROR);
+               else    // $msg can be null here only in debug mode, otherwise the error is ignored
+                       trigger_error($str, E_USER_WARNING);
+       }
        if ($exit)
                exit;
 }