you should surround your variable with quotes ''
, simply change to
WHERE `id` = '" .$id."'")
As suggested you can’t use WHERE
in INSERT
queries but you should use an UPDATE
query so you syntax should look like this:
$result = mysql_query("UPDATE cafes set deal="$deal" WHERE `id` = '" .$id."'") or die(mysql_error());
Then I would like you to remember that mysql_*
functions are deprecated so i would advise you to switch to mysqli
or PDO
4
solved 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 `id` [closed]