$sql = "INSERT INTO `Visitors`(`Cust_id`, `first_name`, `last_name`,
`Email_address`, `Phone_no`, `St_Addr`, `city`, `State`, `zip`, `age`,
`Ethnicity`, `Signup_Date`) VALUES (".'$firstname'.", ".'$lastname'.",
".'$email'.", ".'$telephone'.", ".'$Street_Address'.", ".'$City'.",
".'$State'.",".'$ZIP'.",".' $age'." , ".'$Ethnicity'.",".'$date'.")";
我正在自动增加
答案 0 :(得分:2)
列数不匹配。如果是自动增量,则无需指定ID。
同样'$something'
将逐字插入 $ something 。您希望使用"
插入动态数据。
$sql = "INSERT INTO Visitors
(first_name, last_name, Email_address, Phone_no, St_Addr, city, State, zip, age, Ethnicity, Signup_Date)
VALUES
('".$firstname."', '".$lastname."', '".$email."', '".$telephone."', '".$Street_Address."', '".$City."', '".$State."','".$ZIP."','". $age."' , '".$Ethnicity."','".$date."')";