简体   繁体   English

我的SQL语法有什么问题?

[英]What is wrong with my SQL Syntax?

$query = mysql_query("INSERT INTO comments (sender, receiver, $question) VALUES ('$sender', '$receiver', '$question')")or die(mysql_error());

error being received is... 收到的错误是......

You have an error in your SQL syntax; 您的SQL语法有错误; check the manual that corresponds to your MySQL server version for the right syntax to use near 'question sending) VALUES ('1', '1', 'Testing question sending')' at line 1 查看与您的MySQL服务器版本对应的手册,以便在“问题发送”附近使用正确的语法VALUES('1','1','测试问题发送')'在第1行

你对列名称有$question (这正在成为“测试问题发送”),它应该只是question (没有$)。

INSERT INTO comments (sender, receiver, question) ...

Check your column name for "question". 检查列名称是否为“问题”。 it could be question instead of $question 它可能是问题,而不是$ question

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM