这个查询出了什么问题?语法错误

时间:2013-10-18 23:38:46

标签: php mysql syntax

这有什么问题?它返回“你的语法中有错误......检查你是否有正确的MySQL版本在'to,content,link'附近使用)VALUES ......”

$notito = $idoftheguy;
$contentofnoti = $username." just posted a comment on your update.";
$linkofnoti = "http://mywebsite.net/post.php?id=".$thepostid;
/* Now let's insert this */
$insertnoti = mysql_query("INSERT INTO newnotifications (to, content, link) VALUES ('$notito', '$contentofnoti', '$linkofnoti')");

查询中的所有上述内容都存在于数据库中。以下是给出错误的确切输入(未尝试任何其他输入):

$ notito = 1;
$ contentofnoti =“Schart刚发布了对您的更新的评论。”; $ linkofnoti =“http://mywebsite.net/post.php?id=22”;

1 个答案:

答案 0 :(得分:1)

如前所述。 to是保留字。试试这段代码:

$insertnoti = mysql_query("INSERT INTO newnotifications (`to`, `content`, `link`) VALUES ('$notito', '$contentofnoti', '$linkofnoti')");