MySql语句错误:SQLSTATE [21S01]:插入值列表与列列表不匹配:1136列数与第1行的值计数不匹配

时间:2016-06-09 03:03:07

标签: php mysql sql database

`帮助初学者水平 这是错误

MySql语句错误:SQLSTATE [21S01]:插入值列表与列列表不匹配:1136列数与第1行的值计数不匹配 SQL:插入表单值('丹麦',' 122016',' danish.baksh@hyperquality.com',' devloper',& #39; marketing',' danish baksh' danish.baksh@hyperquality.com',' 156',' fdjfj' ' 564'' FJF'' 867'' DFJ'' 5344',' contactus.png'' 0&#39)

查询

$qry="insert into form values('$empname','$empcode','$empemail','$designation','$process','$supervisior','$supemail','$expense1','$aboutexp1','$expense2','$aboutexp2','$expense3','$aboutexp3','$total','$file_name','0')";

这是数据库

CREATE TABLE `form` (
 `empname` varchar(50) DEFAULT NULL,
  `empcode` varchar(50) DEFAULT NULL,
  `empemail` varchar(50) DEFAULT NULL,
  `designation` varchar(50) DEFAULT NULL,
  `process` varchar(50) DEFAULT NULL,
  `supervisior` varchar(50) DEFAULT NULL,
  `supemail` varchar(50) DEFAULT NULL,
  `expense1` int(50) DEFAULT NULL,
  `aboutexp1` varchar(50) DEFAULT NULL,
  `expense2` int(50) DEFAULT NULL,
  `aboutexp2` varchar(50) DEFAULT NULL,
  `expense3` int(50) DEFAULT NULL,
  `aboutexp3` varchar(50) DEFAULT NULL,
  `total` int(50) DEFAULT NULL,
  `bill` varchar(50) DEFAULT NULL,
  `approved` tinyint(1) DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1

询问您是否需要更多

1 个答案:

答案 0 :(得分:0)

尝试使用以下查询:

$qry="insert into form (empname,empcode,empemail,designation,process, supervisior,supemail,expense1,aboutexp1,expense2,aboutexp2,expense3, aboutexp3,total,bill,approved)
values('$empname','$empcode','$empemail','$designation','$process','$supervisior','$supemail','$expense1','$aboutexp1','$expense2','$aboutexp2','$expense3','$aboutexp3','$total','$file_name','0')";

这可能会有所帮助。此外,您的表中应该有主键。