错误:列计数与值计数不匹配

时间:2018-02-26 08:18:04

标签: php mysql

请检查这是否有任何错误

$sql= "INSERT INTO registration( `date`, `ref`, `name`, `fname`, 
`cell`, `district`, `address`, `gender`, `age`, `face`, `color`, `height`,
 `weight`, `shape`, `disease`, `nationality`, `mother_tongue`, `sect`, 
`cast`, `educational_institution`, `university`, `hobbies`, `skills`, 
`prayer`, `religious_belonging`, `cover_face`, `beard`, `monthly_income`, 
`job_detail`, `house`, `property`, `alive`, `parents_homeland`, 
`father_occupation`, `mother_occupation`, `family_edu`, `birth_no`, 
`brothers`, `sisters`, `married_brothers`, `married_sisters`, 
`second_mrg`, `permission`, `children`, `children_live`, `required_age`, 
`boy_shape`, `boy_color`, `height_boy`, `boy_body`, `mother_lang`, 
`boy_sect`, `boy_cast`, `status`, `college`, `religious`, `balance`, 
`income`, `parents`, `belong_city`, `education`, `family_size`, `system`, 
`requirements`) 

    VALUES ( '$date', '$ref', '$name', '$fname', '$cell', '$district',
'$address', '$gender', '$age', '$face', '$color', '$height', '$weight', 
'$shape', '$disease', '$nationality', '$sect', '$cast', 
'$educational_institution', '$university', '$hobbies', '$skills', 
'$prayer', '$religious_belonging' , '$cover_face', '$beard', 
'$monthly_income', '$job_detail', '$house', '$property', '$alive', 
'$parents_homeland', '$father_occupation', '$mother_occupation', 
'$family_edu', '$birth_no', '$brothers', '$sisters', '$married_brothers', 
'$married_sisters', '$second_mrg', '$permission', '$children', 
'$children_live', '$required_age', '$boy_shape', '$boy_color', 
'$height_boy', '$boy_body', '$mother_lang', '$boy_sect', '$boy_cast', 
'$status', '$college', '$religious', '$balance', '$income', '$parents',
'$belong_city', '$education', '$family_size', '$system', 
'$requirements')";

3 个答案:

答案 0 :(得分:0)

尝试在值变量中使用(“”) 即 - “'。$ date。'”。

答案 1 :(得分:0)

非常正确:
1.插入注册(
插入注册(
2.您可以尝试使用notepad ++或TextWrangler来查找并用'替换所有backtick's
3.因为你有INSERT INTO mother_tongue
你错过了VALUES '$ mother_tongue',
4.替换'$ religious_belonging','$ cover_face',
'$ religious_belonging','$ cover_face',

答案 2 :(得分:0)

尝试此代码, mother_tongue 列值缺失:

$sql= "INSERT INTO registration( `date`, `ref`, `name`, `fname`, 
`cell`, `district`, `address`, `gender`, `age`, `face`, `color`, `height`,
 `weight`, `shape`, `disease`, `nationality`, `mother_tongue`, `sect`, 
`cast`, `educational_institution`, `university`, `hobbies`, `skills`, 
`prayer`, `religious_belonging`, `cover_face`, `beard`, `monthly_income`, 
`job_detail`, `house`, `property`, `alive`, `parents_homeland`, 
`father_occupation`, `mother_occupation`, `family_edu`, `birth_no`, 
`brothers`, `sisters`, `married_brothers`, `married_sisters`, 
`second_mrg`, `permission`, `children`, `children_live`, `required_age`, 
`boy_shape`, `boy_color`, `height_boy`, `boy_body`, `mother_lang`, 
`boy_sect`, `boy_cast`, `status`, `college`, `religious`, `balance`, 
`income`, `parents`, `belong_city`, `education`, `family_size`, `system`, 
`requirements`) 

    VALUES ( '$date', '$ref', '$name', '$fname', '$cell', '$district',
'$address', '$gender', '$age', '$face', '$color', '$height', '$weight', 
'$shape', '$disease', '$nationality','$mother_tongue', '$sect', '$cast', 
'$educational_institution', '$university', '$hobbies', '$skills', 
'$prayer', '$religious_belonging' , '$cover_face', '$beard', 
'$monthly_income', '$job_detail', '$house', '$property', '$alive', 
'$parents_homeland', '$father_occupation', '$mother_occupation', 
'$family_edu', '$birth_no', '$brothers', '$sisters', '$married_brothers', 
'$married_sisters', '$second_mrg', '$permission', '$children', 
'$children_live', '$required_age', '$boy_shape', '$boy_color', 
'$height_boy', '$boy_body', '$mother_lang', '$boy_sect', '$boy_cast', 
'$status', '$college', '$religious', '$balance', '$income', '$parents',
'$belong_city', '$education', '$family_size', '$system', 
'$requirements')";
相关问题