0

I have a form that should write to MyDQL Database but isn't I have been looking at it for hours and it is driving me crazy.

$sqlquery = "INSERT INTO $table VALUES
'$id','$Name','$DoB_Day','$DoB_Month','$DoB_Year','$Address_1','$Address2','$Town','$Postcode','$Telephone','$Mobile','$Email','$6th_Form','$6th_Form_Year','$6th_Form_Institution','$6th_Form_Course_Title','$College','$College_Year','$College_Name','$College_Course','$E2E','$E2E_Provider','$Apprenticeship','$Apprenticeship_Level','$App_Employer_Name','$App_Work_Area','$Employment','$Employment_Basis','$Emp_Employer_Name','$Emp_Job_Title','$Emp_Training','$University','$University_Name','$Uni_Course_Title','$Gap_Year','$Unemployed','$Other')";

I have used this method before and it worked fine but it just isn't playing nicely today.

I have also tried the following;

$sqlquery = "INSERT INTO `connx_iPOD_Comp` ( `id` , `Name` , `DoB_Day` , `DoB_Month` , `DoB_Year` , `Address_1` , `Address2` , `Town` , `Postcode` , `Telephone` , `Mobile` , `Email` , `6th_Form` , `6th_Form_Year` , `6th_Form_Institution` , `6th_Form_Course_Title` , `College` , `College_Year` , `College_Name` , `College_Course` , `E2E` , `E2E_Provider` , `Apprenticeship` , `Apprenticeship_Level` , `App_Employer_Name` , `App_Work_Area` , `Employment` , `Employment_Basis` , `Emp_Employer_Name` , `Emp_Job_Title` , `Emp_Training` , `University` , `University_Name` , `Uni_Course_Title` , `Gap_Year` , `Unemployed` , `Other` ) '
        . 'VALUES('$Name','$DoB_Day','$DoB_Month','$DoB_Year','$Address_1','$Address2','$Town','$Postcode','$Telephone','$Mobile','$Email','$6th_Form','$6th_Form_Year','$6th_Form_Institution','$6th_Form_Course_Title','$College','$College_Year','$College_Name','$College_Course','$E2E','$E2E_Provider','$Apprenticeship','$Apprenticeship_Level','$App_Employer_Name','$App_Work_Area','$Employment','$Employment_Basis','$Emp_Employer_Name','$Emp_Job_Title','$Emp_Training','$University','$University_Name','$Uni_Course_Title','$Gap_Year','$Unemployed','$Other')";
3
Contributors
4
Replies
5
Views
12 Years
Discussion Span
Last Post by PatrickE
0

From what I see... In the first one, you forgot the opening parenthesis. In the second one, you have mismatched values.

Try this:

$sqlquery = "INSERT INTO $table VALUES
('$id','$Name','$DoB_Day','$DoB_Month','$DoB_Year','$Address_1','$Address2','$Town','$Postcode','$Telephone','$Mobile','$Email','$6th_Form','$6th_Form_Year','$6th_Form_Institution','$6th_Form_Course_Title','$College','$College_Year','$College_Name','$College_Course','$E2E','$E2E_Provider','$Apprenticeship','$Apprenticeship_Level','$App_Employer_Name','$App_Work_Area','$Employment','$Employment_Basis','$Emp_Employer_Name','$Emp_Job_Title','$Emp_Training','$University','$University_Name','$Uni_Course_Title','$Gap_Year','$Unemployed','$Other')";

And by the way... if I'm not terribly mistaken... if the ID column is set as auto_increment, then you should use the code below. If it's not... then ignore the code below.

$sqlquery = "INSERT INTO $table VALUES
('','$Name','$DoB_Day','$DoB_Month','$DoB_Year','$Address_1','$Address2','$Town','$Postcode','$Telephone','$Mobile','$Email','$6th_Form','$6th_Form_Year','$6th_Form_Institution','$6th_Form_Course_Title','$College','$College_Year','$College_Name','$College_Course','$E2E','$E2E_Provider','$Apprenticeship','$Apprenticeship_Level','$App_Employer_Name','$App_Work_Area','$Employment','$Employment_Basis','$Emp_Employer_Name','$Emp_Job_Title','$Emp_Training','$University','$University_Name','$Uni_Course_Title','$Gap_Year','$Unemployed','$Other')";
0

Cheers Patrick it was the Parenthesis I think it was a case of looking at the same code for too long and not being able to see the wood for the trees.

Cheers
Mark

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.