mysql - Insert into query is not working php -


 $sql = "insert `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 on auto increment

the number of columns don't match. don't need specify id if autoincrement.

also '$something' literally insert $something. want use " insert dynamic data.

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

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -