Hi,
I'm trying to write some php code that inputs a customer's name, address, phone, and email address into a customer database. I keep getting this error:
Query failed : You have an error in your SQL syntax near '\'\', \'michael\', \'smith\', \'msmith@anydomain.com\', \'1234 anywhere\', \'any' at line 1
my code to construct the insert is this:
$sql = "INSERT INTO customer_data (cust_id, first_name, last_name, email_address, street, city, state, zip, phone, newsletter_subscribed)"
." VALUES(\'\', \'$_REQUEST[first_name]\', \'$_REQUEST[last_name]\', \'$_REQUEST[email]\', \'$_REQUEST[street]\', \'$_REQUEST[city]\',
\'$_REQUEST[state]\', \'$_REQUEST[zip]\', \'$_REQUEST[day_phone]\', \'true\' )";
$result = mysql_query($sql) or die("Query failed : " . mysql_error());
the first value is blank, because its supposed to be autogenerated in the table. I know its probably something simple, I went through these annoying growing pains with C++, but I can't figure this one out all morning.
Also, that second line break (in the VALUE line) doesn't exist in the code, I had to add it so that it would fit the forum screen.
Also, is $_REQUEST the proper variable to use when gathering data from a form just submitted?
Thanks in advance,
Kevin