2009/3/15 PJ <af.gour...@videotron.ca>:
>> -----Original Message-----
>> From: Jan G.B. [mailto:ro0ot.w...@googlemail.com]
>> so this is just wrong:
>> $x = " select *
>> // from foo
>> from bar";
>> and that query would be valid
>> "SELECT this/*, that*/ from x"
> It took ma a bit of thinking, I must say, but the answer is simple:
> You cannot do comment - out's (for that is what this was really about)
> within astatement or declaration! I was commenting out two JOINs within
> a $sql = "SELECT ...... " declaration that was split into several lines
> and it didn't occur to me that you cannot just comment out a part of a
> declaration or statement that spans several lines. So, if you comment
> out one part the rest will still be parsed.
well, actually you could write my example with as much "newlines"
(whitespace) as you want.
$x = "SELECT
/* JOIN x ON a=b
... is valid and mysql will parse it correct as "select this from that".
> There's a reason, then why
> the HTML specification requires that " delimited statements cannot be
> split over several lines. Hope I said all that correctly. :-)
not really correct. the above sql statement is correct, because PHP
has no problem with newlines in a string encapsulated in ", just like
but I think it's not a goog coding style to have newlines, tabs and
alike in a mysql-query; it messes up the logs.
I would do it that way:
$x = "foo"
// . " unused"
. " bar";
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php