-1

I have this error

Error Code: 1136 Column count doesn't match value count at row 1 INSERT INTO fgm_pastor( matriculePastor, pastorName, pastorSurname, pastorBirthdayDate, birthdayPlace, pastorFathername, pastorMothername, pastorSexe, pastorPhone, pastorEmail, dateConversion, workBeforeBibleSchool, rankProbation, areaOfCalling, nberYearArea, nbreYearDistrict, martialSituation, nationality, pastorAdresse, photoProfil, raisonIndispoMissionnaire, id) VALUES ( 'matriculetest3', 'nom test', 'prenomtest', '2013-09-12', 'Dagobert', 'mon pere resr', 'ma mere test', 'M', 'phone test', 'pastorEmail test', '2018-12-28', 'infomaticien', 'rank test', 'area test', 1, 3, 'Single test', 'Cameroun test', 'adresse test', 'phototest', 'RAS', 4 );

I already indicate values column but nothing works

here is my query please help me

 INSERT INTO fgm_pastor(
matriculePastor,
pastorName,
pastorSurname,
pastorBirthdayDate,
birthdayPlace,
pastorFathername,
pastorMothername,
pastorSexe,
pastorPhone,
pastorEmail,
dateConversion,
workBeforeBibleSchool,
rankProbation,
areaOfCalling,
nberYearArea,
nbreYearDistrict,
martialSituation,
nationality,
pastorAdresse,
photoProfil,
raisonIndispoMissionnaire,
id) 
VALUES
(
'matriculetest3',
'nom test',
'prenomtest',
'2013-09-12',
'Dagobert',
'mon pere resr',
'ma mere test',
'M',
'phone test',
'pastorEmail test',
'2018-12-28',
'infomaticien',
'rank test',
'area test',
1,
3,
'Single test',
'Cameroun test',
'adresse test',
'phototest',
'RAS',
4
);

here is my table structure


CREATE TABLE `fgm_pastor` (
    `matriculePastor` VARCHAR (180),
    `pastorName` VARCHAR (180),
    `pastorSurname` VARCHAR (180),
    `pastorBirthdayDate` DATE ,
    `birthdayPlace` VARCHAR (180),
    `pastorFatherName` VARCHAR (180),
    `pastorMotherName` VARCHAR (180),
    `pastorSexe` CHAR (3),
    `pastorPhone` VARCHAR (180),
    `pastorEmail` VARCHAR (180),
    `dateConversion` DATE ,
    `workBeforeBibleSchool` VARCHAR (180),
    `rankProbation` VARCHAR (180),
    `areaOfCalling` VARCHAR (300),
    `nberYearArea` INT (11),
    `nbreYearDistrict` INT (11),
    `martialSituation` VARCHAR (180),
    `nationality` VARCHAR (180),
    `pastorAdresse` VARCHAR (300),
    `photoProfil` TEXT ,
    `isActif` TINYINT (1),
    `raisonIndispoMissionnaire` TEXT ,
    `isDelete` INT (1),
    `id` INT (11)
); 
  • 1
    I can't see your query. Please see [Why should I provide a Minimal Reproducible Example for a very simple SQL query?](https://meta.stackoverflow.com/questions/333952/why-should-i-provide-a-minimal-reproducible-example-for-a-very-simple-sql-query) – Alberto Moro Jul 11 '19 at 09:09
  • Possible duplicate of [Column count doesn't match value count at row 1](https://stackoverflow.com/questions/18369252/column-count-doesnt-match-value-count-at-row-1) – Madhur Bhaiya Jul 11 '19 at 09:33
  • 1
    You can [edit] your question, please don't post code in comments – barbsan Jul 11 '19 at 11:33

1 Answers1

0

Use backticks for the columns name and work. Some of your column names are MySQL reserved words and it is better not to use them as column names:

INSERT INTO fgm_pastor 
    ( matricule, `name`, surname, birthdayDate, birthdayPlace, fatherName, 
    motherName, gender, phone, email, dateC, `work`, rankProbation, 
    areaOfCalling, nberArea,nbreDistrict, martialSituation, nationality, 
    adresse, picture, raisonIndis, id) 
VALUES ( 'matricust3', 'nom test', 'prenomtest', '2013-09-12', 'Dagobert', 'monperesr', 
    'mamere', 'M', 'phone test', 'pastorEmail test', '2018-12-28', 'infomaticien', 'rank test', 
    'area test', 1, 3, 'Single test', 'Cameroun test', 
    'adresse test', 'phototest', 'RAS', 4)
nacho
  • 5,280
  • 2
  • 25
  • 34
  • thank you for answer i change those two column name it is still the same error – Raphael Gloire Jul 11 '19 at 09:50
  • Can you upload your table structure? Maybe you are missing some columns – nacho Jul 11 '19 at 09:51
  • CREATE TABLE `fgm_pastor` ( `mleP` VARCHAR (60), `pName` VARCHAR (60), `pSurname` VARCHAR (60), `pBirthday` DATE , `birthdayPlace` VARCHAR (60), `pFather` VARCHAR (60), `pMother` VARCHAR (60), `pGender` CHAR (3), `pPhone` VARCHAR (60), `pEmail` VARCHAR (60), `PConver` DATE , `Pwork` VARCHAR (60), `pRank` VARCHAR (60), `pArea` VARCHAR (60), `pNberArea` INT (11), `pNbreDist` INT (11), `pMartial` VARCHAR (60), `pCountry` VARCHAR (60), `pAdress` VARCHAR (60), `picture` TEXT , `isActif` TINYINT (1), `raisIndisp` TEXT , `isDelete` INT (1), `id` INT); – Raphael Gloire Jul 11 '19 at 10:02
  • The names of the columns are not equal in your CREATE statement and in your INSERT statement – nacho Jul 11 '19 at 10:33
  • thank you i wrote it like that beacause the syntaxe was too long the i can't add it all as à comment – Raphael Gloire Jul 11 '19 at 11:34
  • @RaphaelGloire please do not post `code` in comments – Martin Jul 11 '19 at 11:39