Re: Usng Session Vaiable in WHERE Statement

From: Date: Mon, 26 Jul 2004 12:12:48 +0000
Subject: Re: Usng Session Vaiable in WHERE Statement
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-191879@lists.php.net to get a copy of this message
At 13:58 26-7-04, you wrote:
Could someone please help me with my syntax here...? $MembersDataQry = "SELECT * FROM MembersData WHERE UserID='$_SESSION['logname']'"; I get an error on line 2 but can't seem to figure out what I've missed.
1. You have errors with the ' quote: you use it to wrap the entire array as well as for the index. That does not work. 2. Try not to put array names within double quotes. PHP has troubles recognizing where the array start and ends. Either wrap the array name and indexes in {} (for details check the manual) or rather jump out of the quotes. preferred: $MembersDataQry = 'SELECT *
                        FROM MembersData
                        WHERE UserID="'.$_SESSION['logname'].'";';


« previous php.general (#191879) next »