插入查询不工作php [关闭]

 $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'.")";

Id is on auto increment

The number of columns don't match. You don't need to specify the ID if it is autoincrement.

Also '$something' will literally insert $something. You want to use " to insert dynamic data.

$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."')";