I have small problem with my SQL code:
UPDATE articles SET like=like+1 WHERE id=1
When I’m trying to execute it in PhpMyAdmin, I’m getting this error:
#1064 - 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 'like=like+1 WHERE id=1' at line 1
Column like is int defaultly set to 0 (length 11).
Does anybody know how can I repair it? Please help.
LIKE is a keyword and cannot be used as a column name. You could change it (in your query) to
`like`=`like`+1(with backticks), but that’s hardly solving the problem.Rename your column.