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]
|