Reply to Re: correct syntax?

Your name:

Reply:


Posted by Kimmo Laine on 06/17/05 06:59

"toedipper" <send_rubbish_here734@hotmail.com> kirjoitti
viestissδ:3Gnse.18341$K5.6706@newsfe4-win.ntli.net...
> Hello,
>
> Is this the right syntax for assigning a sql selct to a variable. When I
> use this I get a parse error on the line that this is on.
>
> $thecustid = 'SELECT custid FROM customers WHERE userid =
> $_SESSION['MM_Username']';


Using single qoutes in this case is wrong because a) you've got single
qoutes inside single qoutes, and that my freind, makes php go apeshit. b) it
doesn't interpret variables inside a string if the string is delimited by
single qoutes.

Throw in some double qoutes:
$thecustid = "SELECT custid FROM customers WHERE userid =
$_SESSION['MM_Username']";

And that should work.

--
"I am pro death penalty. That way people learn
their lesson for the next time." -- Britney Spears

eternal.erectionN0@5P4Mgmail.com

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация