Posted By

stancell on 08/21/08


Tagged

mysql log query firebug


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

jirimelcak


Show mysql query log with firebug


 / Published in: PHP
 

Replace all mysqlquery() calls in your project to debugmysql_query() to see all mysql queries in Firebug console.

  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  

You need to login to post a comment.