我有问题,我的MySQL查询:MySQL的INSERT查询
include '../inc/mysql_config.php';
$sql="INSERT INTO ordrar
(id, order, namn, adress, postnummer, postort, email, status)
VALUES
(NULL, '$order','$namn','$adress','$postnummer', '$postort', '$email', '$email', '$status')";
mysql_query($sql);
if (!mysql_query($sql)) { die('Error: ' . mysql_error()); }
此输出:
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 'order, namn, adress, postnummer, postort, email, status) VALUES ' at line 1
感谢。
解决:
include '../inc/mysql_config.php';
$sql="INSERT INTO ordrar (id, substans, namn, adress, postnummer, postort, email, status)
VALUES
(NULL, '$substans','$namn','$adress','$postnummer', '$postort', '$email', '$status')";
mysql_query($sql);
if (!mysql_query($sql))
{
die('Error: ' . mysql_error());
}
谢谢大家!
指定8列并传递9个值,其中'email'值为两次。 – Joost 2010-07-10 21:51:38