Re: left join does not work, why?

From: Date: Sun, 15 Mar 2009 20:59:27 +0000
Subject: Re: left join does not work, why?
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-290095@lists.php.net to get a copy of this message
2009/3/15 PJ <af.gourmet@videotron.ca>: >> -----Original Message----- >> From: Jan G.B. [mailto:ro0ot.w00t@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 */ this FROM that"; ... 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 mysql. 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"; byebye

« previous php.general (#290095) next »