About PHP SQL Format

This lib can make the SQL look better, and format the SQL into HTML code

Actually,it's just wrapped around libraries of phpmyadmin

Demo

Download

Screenshot

Project on Google Code

How-To
Screenshot:
screenshot-sqlparser
How-to:
  • Download the librariesPut them in your WEB dirctory
  • Edit your php file:
    1.  
    2. <link rel="stylesheet" href="sqlparserlib/sqlsyntax.css" />
    3. <?php
    4. define("PARSER_LIB_ROOT", "/home/admin/www/sqlparserlib/");
    5. require_once PARSER_LIB_ROOT."sqlparser.lib.php";
    6. function SQLFormatPHP($sql){
    7. return PMA_SQP_formatHtml(PMA_SQP_parse($sql));
    8. }
    9.  
    10. $sql = "SELECT * FROM (select * from dual)";
    11. echo SQLFormatPHP($sql);
    12. ?>
  • Notice: /home/admin/www/sqlparserlib/ you must set this to your right PATH