You are here: Re: correct syntax? « PHP Language « IT news, forums, messages
Re: correct syntax?

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

 

Navigation:

[Reply to this 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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация