michael-marinetti

Log MySQL errors, without die()

Sep 5th, 2011
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1. <?php
  2. // Description :  With this modifications, mysql error will be added in a logfile
  3. // the color name if available
  4. // using Prestashop > 1.4.4
  5. class MySQL extends MySQLCore
  6. {
  7.     public function displayMySQLError($query = false)
  8.     {
  9.         if($query)
  10.         {
  11.             $debug = debug_backtrace();
  12.             file_puts_content(_PS_ROOT_DIR_."/log/mysql_err.log",'error from '.print_r($debug[1], true).'<br/>'.$query, FILE_APPEND);
  13.         }
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment