the following 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 ')' at line 2 using the following code to do it: <?php $con = mysql_connect("localhost","deedpoll_adult","adult"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("deedpoll_adultpurchaseinfo", $con); $sql="INSERT INTO adultpurchaseinfo (adult_current_full_name, adult_desired, DOB_day, DOB_month, DOB_year, whereborn_radiobutton, country_individual_born_in, country_individual_father_born_in,country_individual_mother_born_in,cameuk_day,cameuk_month,cameuk_year,immigration_status,date_radiobutton,dated_day,dated_month,dated_year,house_number,street,line_2,town,county,postcode,scode) VALUES('$_POST[adult_current_full_name]','$_POST[adult_desired]','$_POST[DOB_day]','$_POST[DOB_month]','$_POST[DOB_year]','$_POST[whereborn_radiobutton]','$_POST[country_individual_born_in]''$_POST[country_individual_father_born_in]','$_POST[country_individual_mother_born_in]','$_POST[cameuk_day]','$_POST[cameuk_month]','$_POST[cameuk_year]','$_POST[immigration_status]','$_POST[date_radiobutton]','$_POST[dated_day]','$_POST[dated_month]','$_POST[dated_year]','$_POST[house_number]','$_POST[street]','$_POST[line_2]','$_POST[town]','$_POST[county]','$_POST[postcode]','$_POST[scode]',)"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } mysql_close($con) ?> PHP: I just cant see the error - anyone else?
try this $sql="INSERT INTO adultpurchaseinfo (adult_current_full_name, adult_desired, DOB_day, DOB_month, DOB_year, whereborn_radiobutton, country_individual_born_in, country_individual_father_born_in,country_individual_mother_born_in, cameuk_day,cameuk_month,cameuk_year,immigration_status,date_radiobutton,dated_day,dated_month, dated_year,house_number,street,line_2,town,county,postcode,scode) VALUES('$_POST[adult_current_full_name]','$_POST[adult_desired]','$_POST[DOB_day]','$_POST[DOB_month]', '$_POST[DOB_year]','$_POST[whereborn_radiobutton]','$_POST[country_individual_born_in]', '$_POST[country_individual_father_born_in]','$_POST[country_individual_mother_born_in]','$_POST[cameuk_day]', '$_POST[cameuk_month]','$_POST[cameuk_year]','$_POST[immigration_status]','$_POST[date_radiobutton]', '$_POST[dated_day]','$_POST[dated_month]','$_POST[dated_year]','$_POST[house_number]','$_POST[street]', '$_POST[line_2]','$_POST[town]','$_POST[county]','$_POST[postcode]','$_POST[scode]')";
As corrected by Kakek, you didn't have a comma between $_POST[country_individual_born_in] and $_POST[country_individual_father_born_in]. You may also have other errors depending on what the values of the variables can be. Remember that - and I'm not sure how accurate this is - strings have to be enclosed in quotation marks, NULL values must not be enclosed in quotation marks, and numerals do not have to be enclosed in quotation marks.
If you're going straight from an unescaped string, you really should use the '".$_POST['var']."' syntax to prevent the string from being closed by a hanging single quote in one variable. Numbers technically don't need to have single quotes around them.