I have an UPDATE query I’d like to perform.
But there need to be 2 conditions met before we can update a quantity in the database.
First, the sessions_id() must match one of the sessionid’s in the sessionid column, and second, the Description of the product must match the description of the product corresponding to the sessionid.
Here’s what I have:
mysql_query(UPDATE cart
SET quantity = $q,
WHERE sessionid = "'.session_id().'"
AND description = $d') or die(mysql_error());
Now, it is giving me the following error:
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 ‘WHERE sessionid=”bqlbh5rdogbhmq70skhtkbvmb0″ AND description=$d’ at line 1
However, I have copied this update query straight from W3Schools, so it must be correct, right? Any help at all would be appreciated.
It should look that way: