Fatal error: Uncaught PDOException: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1 in code example
Example 1: Insert value list does not match column list: 1136 Column count doesn't match value count at row 2"
In your database table not null columns created are less than the values that
you are passing in the insert query
Example : Assume Your database table has 35 columns
Then,
Where as the values you are passing are 34 columns
This mismatch of columns is giving you the error.
You must have forgot to pass the value for not null column. once you pass
it error will be resolved
Example 2: Fatal error: Uncaught PDOException: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1 in
;
;
;
;
;
;
;
DROP TABLE IF EXISTS `followers`;
CREATE TABLE `followers` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) unsigned NOT NULL,
`follower_id` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `login_tokens`;
CREATE TABLE `login_tokens` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`token` char(64) NOT NULL DEFAULT '',
`user_id` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `token` (`token`),
KEY `user_id` (`user_id`),
CONSTRAINT `login_tokens_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `password_tokens`;
CREATE TABLE `password_tokens` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`token` char(64) NOT NULL DEFAULT '',
`user_id` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `token` (`token`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(32) DEFAULT NULL,
`password` varchar(60) DEFAULT NULL,
`email` text,
`verified` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
;
;
;
;
;
;