Reply to Re: correct syntax?

Your name:

Reply:


Posted by Tony on 06/17/05 03:50

toedipper wrote:
> 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']';

No.

You have a few problems. First of all, you are using single-quotes inside a
single-quoted string. Second, you can't include an array variable inside a
string like that you'll have to use concatenation. Third, you aren't
quoting the string content in the query - I expect this will likely cause
problems on the SQL side.

Try
$thecustid = "SELECT custid FROM customers WHERE userid='" .
$_SESSION['MM_Username'] . "'";

--
Tony Garcia
Web Right! Development
tony@webrightdevelopment.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

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