views:

28

answers:

1

Hi All, I am trying to make a edit profile page and i want the user to be able to change there username and email address. I've been going at this problem now for sometime and need your help.

Parse error: syntax error, unexpected T_VARIABLE

$edit = mysql_query("UPDATE users (Username, EmailAddress) VALUES('".$newusername."', '".$newemail."') WHERE UserID="$_SESSION['UserID']"");
+5  A: 

you're missing some dots around $_SESSION['UserID']

$edit = mysql_query("UPDATE users (Username, EmailAddress) VALUES('".$newusername."', '".$newemail."') WHERE UserID=" . $_SESSION['UserID']);
Marek Karbarz
Thanks, I'm not getting "Parse error: syntax error, unexpected '['"
ritch
@ritch: Please read Marek's answer carefully. You didn't use his code. I suggest you read about [string concatenation](http://php.net/manual/en/language.operators.string.php) and [arrays](http://php.net/manual/en/language.types.array.php).
Felix Kling
@ritch: You must move the dot after `$_SESSION` after `['UserID']` so you have `UserID = ".$_SESSION['UserID'].""`. And as Marek wrote, you may omit concating the empty string, so you have: `UserID = ".$_SESSION['UserID']`.
nikic
Yeh thanks, I was rushing. Stupid me!
ritch