나는 내가 달리고있는 MySQL 쿼리를 가지고있다. articleswritten
이라는 필드에 1
을 추가하고 싶습니다.MySQL 필드에 1을 더하는 것
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 ''users' SET articleswritten = articleswritten + 1 WHERE
id
= '1'' at line 1
코드 :
$sql = "UPDATE 'users' SET articleswritten = articleswritten + 1 WHERE `id` = '$userid'";
$result = mysql_query($sql) or die(mysql_error());
내가 문제를 찾을 수 없습니다
나는이 오류가 발생합니다. 내가 장님인가?
도움을 주시면 감사하겠습니다.
'users'는 테이블 이름이므로 작은 따옴표로 묶지 마십시오. 'UPDATE users SET ....'백틱으로 선택적으로 인용 할 수 있습니다. –
http://stackoverflow.com/questions/11321491/mysql-when-to-use-single-quotes-double-quotes-and-backticks를 참조하십시오. –