02-20-2008, 07:38 PM
|
#5 (permalink)
|
|
The Acquainted
Join Date: Nov 2007
Posts: 154
Thanks: 31
|
Now, if you're talking about SQL within a PHP script, I find the overall best solution (not in every case, mind you) is to use HEREDOC syntax, e.g.
PHP Code:
$sql = <<< END_SQL SELECT column1 , column2 , date_column FROM sometable WHERE pkID = 1024 END_SQL;
The limitation is that the end statement (in this case END_SQL, can be anything you want) has to be on a non-indented line. So it's great for a script that doesn't have a bunch of conditional blocks that have to be intented. Unfortunately the syntax highlighter has a problem so it doesn't 'pop' as it should, but it works great. Easy to edit, not to mention allowing you the ability to have a HUGE multi-table JOIN that you can actually decipher.
Second best method, IMHO is to simply use PHP's ability to ignore whitespace as Pete pointed out.
PHP Manual Language Reference | Types : Strings | HEREDOC syntax
__________________
I reject your reality, and substitute my own.
|
|
|
|