Reputation: 13
I am getting an error saying that column count doesn't match value count at row 1 when I try to insert this SQL statement.
INSERT INTO APPLICANT (fullName, Email, CompanyName, Phone, Fax, GovernmentEmployee, Academic, InternationalAttendee, SpeakerOrPresenter, FirstTimeAttendee)
VALUES
('$fullName','$Email','$CompanyName','$Telephone','$Fax', $GovernmentEmployee, $Academic, $InternationalAttendee, $Speaker, $Presenter, $FirstTimeAttendee);
Upvotes: 1
Views: 143
Reputation: 13313
You try to insert into column : SpeakerOrPresenter
.
Two different values : $Speaker
and $Presenter
.
Therefore, you have more values to insert than columns to receive the data.
You could change your query to make it look like this (where the column SpeakerOrPresenter is splitted into 2 different columns):
INSERT INTO APPLICANT (fullName, Email, CompanyName, Phone, Fax, GovernmentEmployee, Academic, InternationalAttendee, Speaker, Presenter, FirstTimeAttendee)
VALUES
('$fullName','$Email','$CompanyName','$Telephone','$Fax', $GovernmentEmployee, $Academic, $InternationalAttendee, $Speaker, $Presenter, $FirstTimeAttendee);
or like this (where the two values speaker and presenter are merged into a single one) :
INSERT INTO APPLICANT (fullName, Email, CompanyName, Phone, Fax, GovernmentEmployee, Academic, InternationalAttendee, SpeakerOrPresenter, FirstTimeAttendee)
VALUES
('$fullName','$Email','$CompanyName','$Telephone','$Fax', $GovernmentEmployee, $Academic, $InternationalAttendee, $SpeakerOrPresenter, $FirstTimeAttendee);
Upvotes: 1
Reputation: 22204
You have 10 columns listed in the INSERT clause and 11 values in the VALUES clause . You must have the same number in each clause. You have a $Speaker
and a $Presenter
for values, but only a SpeakerOrPresenter
column that seems to be for both.
Upvotes: 1