'Mysql Result consisted of more than one row SQL=INSERT INTO
While inserting for the first time it gave the following error:
Result consisted of more than one row.
When I try to insert record for the second time, it gave me error with message: duplicate entry.
SQL:
INSERT INTO `master_user` (`name`,`user_name`,`email`,`password`,`system_name_of_friend`,`system_no_of_friend`,`registered_from_site`,`registered_on`,`is_existing_user`)
VALUES ('FirstName LastName','username','[email protected]','8c71eede42e38709e9e836021b0b9b9b','','','site','','1')
Any help will be appreciated, and following is the table structure which will be a help to track this issue.
CREATE TABLE IF NOT EXISTS `master_user` (
`master_user_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`user_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`system_name_of_friend` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`system_no_of_friend` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`registered_from_ip` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
`registered_from_site` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
`registered_on` datetime DEFAULT NULL,
`is_existing_user` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`master_user_id`),
UNIQUE KEY `ukMasterUser_email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1293 ;
Solution 1:[1]
You shall remove the ' enclosing the bit value, it would have been interpreted as a character, which is more than 1 bit. And make the date null as well, instead of inserting ''.
INSERT INTO `master_user` (`name`,`user_name`,`email`,`password`,`system_name_of_friend`,`system_no_of_friend`,`registered_from_site`,`registered_on`,`is_existing_user`)
VALUES ('FirstName LastName','username','[email protected]','8c71eede42e38709e9e836021b0b9b9b','','','site',null,1);
SQLFiddle: http://sqlfiddle.com/#!2/eda2ff
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
