"Harlequin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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. > > The variable echoes fine so I know there's a string in there. >
To use array values within double quotes you have to put curly braces around them: $MembersDataQry = "SELECT * FROM MembersData WHERE UserID='{$_SESSION['logname']}'"; Or concatenate the string: $MembersDataQry = "SELECT * FROM MembersData WHERE UserID='" . $_SESSION['logname'] . "'"; Remember to apply mysql_real_escape_string() on any values used within a query. Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php