我有問題,我的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