0
votes

`Help beginner level here is the error

MySql statement Error: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1 SQL: insert into form values('danish','122016','[email protected]','devloper','marketing','danish baksh','[email protected]','156','fdjfj','564','fjf','867','dfj','5344','contactus.png','0')


query

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

here is the database

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

ask if u need more

1
You should have primary key in your table.Manish

1 Answers

0
votes

Try using below query:

$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')";

It may help. Moreover, You should have primary key in your table.