Show mysql query log with firebug


/ Published in: PHP
Save to your folder(s)

Replace all mysql_query() calls in your project to debug_mysql_query() to see all mysql queries in Firebug console.


Copy this code and paste it in your HTML
  1. if (!function_exists('debug_mysql_query')) {
  2.  
  3. function debug_mysql_query($query)
  4. {
  5. $js_query = str_replace(array('\\', "'"), array("\\\\", "\\'"), $query);
  6. $js_query = preg_replace('#([\x00-\x1F])#e', '"\x" . sprintf("%02x", ord("\1"))', $js_query);
  7. echo '<script>console.log("'.$js_query.'");</script>'."\n";
  8. return mysql_query($query);
  9. }
  10. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.