以下代码是我在 PHP 中使用的 SQL 查询。
$sql = "INSERT INTO updates (update,user_id_fk)
VALUES ('$post_update','$username')";
它不起作用 - 我在运行时收到以下错误消息。
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 'update,user_id_fk)
这个语法对我来说很好 - 它与我在 W3School 上找到的一样。
我使用的mysql版本是5.5.24
最佳答案
update是保留关键字反引号吧
INSERT INTO updates (`update`,user_id_fk)
检查下面的列表,以后不要将这些词用于您的表名或列名
关于php - MySql 查询 - 语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23892392/