php-sqlformat


It can help you Format your SQL. Make SQL look better

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:

  1. Download the libraries from : http://code.google.com/p/php-sqlformat/downloads/list

    Put them in your WEB dirctory

  2. 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

  1. screenshot

  1. if problem, mail me : orczhou@gmail.com

Project Information

Labels:
php SQLParser SQL