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 MYS
I have used PHPDesigner. i think this will be fulfill what you expecting.
As an alternative solution, I can suggest copying the text (ALL THE PHP CODE in the *.php file) into the query editor of Heidisql, clicking Re-Format and copying back to NetBeans and pressing Alt+Shift+F. This will format sql and format php code after, preserving sql formatting. SO instead of a plug in, you're copying, formatting a whole file, copying back and formatting again.
Instead of HeidiSQL, you can use this tool, which is focused on formatting if you are comfortable with web tools like these.
If you want more automation, you can use regular expression support of netbeans to format with backslash n = \n for new line befre each "insert, update delete, select, where and values" terms running this 6 times will replace all " insert" <- blank plus insert, in your projects with new lines. you can write a regular expression for searching all, "blank plus reserved word", combinations and replace them with new lines.
You can also use it like search for " insert" and repalce with "\n\t insert", which would create a new line an a tab
Considering the question: Is there an IDE that will automatically format sql queries, I must concur with ugurcode. The answer is simple: there isn't any. And with good reason.
Basically an SQL query is nothing but a string in any IDE. Since strings can contain intentional whitespaces and tabs, it would be very bad if an IDE would reformat string content.
The only option that would work for any IDE would be to detect INSERT, UPDATE, DELETE at the start of a string and then format the rest of the string.. ofcourse it would also try to do the same with a string saying "insert quote here..", which once again would be a bad thing.
Since i don't want to leave you with just nothing i will give you advice on a good IDE to choose which does in fact do proper code formatting, code completion, good indentation, plugins etc.. and basically is the best IDE for php development (atleast its the best i've found in my years of professional php development).
Netbeans would be your IDE of choice. It's faster then i.e. Eclipse/PHP, more stable then i.e. codelobster etc.
If there is no support in all the many IDEs for such a thing, there is a reason in most cases. Please consider prepared statements oder object wrappers for your work. I know both things can't be implemented in every system within a few minutes, but your code will become maintainable.
In short: IDEs cant correct design errors. They just make them look nice and colored.
may be nuSphere debugger somehow help you for doing this here is the link nuSphere
Write your queries in MySQL Workebench then edit->format->beautify query
Then paste the query into netbeans, select the test and tab in.