My code is
$user_query = '
UPDATE
users
SET
`password`="$password",
`email`="$email",
`position`="$position",
WHERE
`username`=".$uname."';
$user_result = mysql_query($user_query, $connection);
confirm_query($user_result);
When I run this query it gives me an error:
Database query failed: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax to use near ‘WHEREusername=”.$uname.”‘ at line 7
Can any body help me resolve this error?
Your query is in single quotes, so the variables aren’t parsed. As you can see in error, the string is literally
You need to either use double quotes around the enitre thing, to parse variables correctly.
Or correctly use the string concatanation operator,
..As others have noted, there’s also an extra
,afterpostion="$position".