尝试插入几个值时出现PHP / MySQL语法错误

How can I fix this line in PHP/MySQL? The server returns the 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 ''id', 'title', 'yes', 'no') VALUES (2,test, 0, 0)' at line 1

for the line

mysql_query("INSERT INTO things('id', 'title', 'yes', 'no') VALUES ($counter,$thing, 0, 0);", $con);
"INSERT INTO things (`id`, `title`, `yes`, `no`) VALUES ($counter,$thing, 0, 0);"

Use ticks and not single quotes. Also, you are not quoting your string there. You should do proper sanitization.

You should switch to PDO or mysqli. mysql_ functions are deprecated.

You need quotes around $counter and $thing

mysql_query("INSERT INTO things('id', 'title', 'yes', 'no') 
VALUES ('$counter','$thing', 0, 0);", $con);