此查询有效:
$con = mysql_connect("localhost","root","pw");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("db", $con);
$sql="INSERT INTO l1_clubmsg (msg, subject, status)
VALUES
(1,1,1)";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con);
但是当我改变时:
$sql="INSERT INTO l1_clubmsg (msg, subject, status)
VALUES
(1,1,1)";
到:
$sql="INSERT INTO l1_clubmsg (msg, subject, status, to)
VALUES
(1,1,1,1)";
我收到此错误:
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 'to) VALUES (1,1,1,1)' at line 1
l1_clubmsg 中确实存在“to”列
任何想法为什么会出错?谢谢