Format MySQL code inside PHP string

Posted by JohnA on Stack Overflow See other posts from Stack Overflow or by JohnA
Published on 2012-06-12T21:32:39Z Indexed on 2012/06/21 21:16 UTC
Read the original article Hit count: 136

Filed under:
|
|

Is there any program IDE or not that can format MySQL code inside PHP string e.g. I use PHPStorm IDE and it cannot do it.

It does that for PHP and MYSQL but not for MYSQL inside php string. I am ready to use new IDE because now i have to manually format hundreds of database requests that are one line and not readable. Only criteria for my choice is that ide can do that automatically.

<?php
...
$request1 = "select * from tbl_admin where admin_id= {$_SESSION['admin_id']} and active= 1 order By admin_id Asc";
...
?>

should become

<?php
...
$request1 = "SELECT * 
               FROM tbl_admin 
                  WHERE admin_id = {$_SESSION['admin_id']}
                  AND active = 1
                      ORDER BY admin_id ASC";
...
?>

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql