
php-sqlformat
Using some libraries of phpmyadmin, Make the SQL look better.
Format your SQL.
Beautify your sql but also can turn your formatted sql into html code.
How to:
Download the libraries from : http://code.google.com/p/php-sqlformat/downloads/list
Put them in your WEB dirctory
edit your php file
define('PARSER_LIB_ROOT', "/home/admin/www/sqlparserlib/");
require_once PARSER_LIB_ROOT.'sqlparser.lib.php';
function SQLFormatPHP($sql){
return PMA_SQP_formatHtml(PMA_SQP_parse($sql));
}
$sql = "SELECT * FROM (select * from dual)";
echo SQLFormatPHP($sql);
?>
Notice: /home/admin/www/sqlparserlib/ you must set this to your right PATH
- screenshot
- if problem, mail me : orczhou@gmail.com