estrangedfellow Posted March 23, 2010 Share Posted March 23, 2010 Hiya. I was wondering if you guys can help me on a problem I have been having with PHP session variables. I am trying to use a session variable I created called username in an sql query. The error I have is; Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/st622/public_html/cw/editconfirm.php on line 25 Line 25; $sql1 = ("UPDATE Dealers SET LName='$LName', FName='$FName', UserName='$UserName, Password=password('$Password'), Email='$Email' WHERE UserName=($_SESSION['username'])"); Essentially, what I’m trying to do is get the query to show one record. That record is the details of the user who is currently logged on. The data will then appear in a form. This form will allow the user to edit their data. What I am doing wrong here? Any pointers or guidance would be really appreciated. Thanks. Link to comment https://forums.phpfreaks.com/topic/196287-php-session-variables/ Share on other sites More sharing options...
o3d Posted March 23, 2010 Share Posted March 23, 2010 $sql1 = ("UPDATE Dealers SET LName='$LName', FName='$FName', UserName='$UserName, Password=password('$Password'), Email='$Email' WHERE UserName=({$_SESSION['username']})"); encapsulate the variable in { } Link to comment https://forums.phpfreaks.com/topic/196287-php-session-variables/#findComment-1030748 Share on other sites More sharing options...
estrangedfellow Posted March 23, 2010 Author Share Posted March 23, 2010 It worked! Feel so stupid, all those hours on a pair of curly brackets.. Thank you sooo much Link to comment https://forums.phpfreaks.com/topic/196287-php-session-variables/#findComment-1030752 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.