【发布时间】:2010-02-28 19:34:37
【问题描述】:
我一直在互联网上寻找解决以下错误的方法;
"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 'primary, username, password, password2) VALUES (null, 'hello', 'hello', 'hello')' at line 1"
我不知道发生了什么。我知道你会在这里问我的代码是什么:
$con = mysql_connect("localhost","root","*****");
if (!$con)
{
die('Server overload, please try again' . mysql_error());
}
mysql_select_db("users", $con);
$sql = "INSERT INTO details (primary, username, password, password2) VALUES (null, '$_POST[username]', '$_POST[password]', '$_POST[password2]')";
if (!mysql_query($sql,$con))
{
die('Error: Server overload, try again' . mysql_error());
}
echo "You have signed up successfully!";
mysql_close($con);
我已经尝试了大约 4/5 小时,但没有成功。
谢谢,
劳伦斯
【问题讨论】:
-
我刚刚搜索了“您的 SQL 语法有错误;请查看手册”。也许您只是在谷歌上搜索整个错误?前几个结果是正确答案。
标签: php sql mysql mysql-error-1064