yoursurrogategod Posted January 17, 2013 Share Posted January 17, 2013 Why am I getting this error? This is my table, I didn't make report_id 'unique' or 'primary', so what gives? CREATE TABLE `daily_monitoring_form` ( `report_id` int(10) unsigned NOT NULL, `department` int(10) unsigned NOT NULL, `month_year` date NOT NULL, `solution` varchar(100) character set utf8 collate utf8_unicode_ci default NULL, `temperature` char(1) character set utf8 collate utf8_unicode_ci default NULL, `bottle_1_opened` date default NULL, `bottle_1_expired` date default NULL, `bottle_2_opened` date default NULL, `bottle_2_expired` date default NULL, `machine_num` varchar(100) character set utf8 collate utf8_unicode_ci default NULL, PRIMARY KEY (`report_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `daily_monitoring_form` -- INSERT INTO `daily_monitoring_form` (`report_id`, `department`, `month_year`, `solution`, `temperature`, `bottle_1_opened`, `bottle_1_expired`, `bottle_2_opened`, `bottle_2_expired`, `machine_num`) VALUES (1, 5, '2013-01-01', 'Cidex', 'F', '2013-01-02', '2013-01-30', '2013-01-02', '2013-01-30', '12'); I tried inserting -- from inside of phpMyAdmin -- a new entry with the same report_id and I got that error, why? Quote Link to comment https://forums.phpfreaks.com/topic/273286-1062-duplicate-entry-1-for-key-1/ Share on other sites More sharing options...
Maq Posted January 17, 2013 Share Posted January 17, 2013 This is my table, I didn't make report_id 'unique' or 'primary', so what gives? Yes you did: PRIMARY KEY (`report_id`) Quote Link to comment https://forums.phpfreaks.com/topic/273286-1062-duplicate-entry-1-for-key-1/#findComment-1406490 Share on other sites More sharing options...
yoursurrogategod Posted January 17, 2013 Author Share Posted January 17, 2013 Yes you did: PRIMARY KEY (`report_id`) And now I feel silly. Thanks for pointing it out. Quote Link to comment https://forums.phpfreaks.com/topic/273286-1062-duplicate-entry-1-for-key-1/#findComment-1406498 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.