MySQL Forums
Forum List  »  Newbie

Error 1062
Posted by: Danne Vendel
Date: July 26, 2018 04:50AM

Hi!

I'm completely lost when it comes to MySQL. Anyway, I'm putting together an installation of shopping cart OpenCart, plain vanilla, no extras, clean install yesterday.

Added first product without problems. But can't add any more as I get error:

---

Notice: Error: Duplicate entry '0-2' for key 'PRIMARY'
Error No: 1062

INSERT INTO adam_product_description SET product_id = '0', language_id = '2', name = 'Ändbeslag', description = '<p>Ändbeslag - Räckhållare</p><p>Däcksbeslag för 22 mm (7/8) rör<br></p><p>Ändbeslag</p><p>Rostfritt</p>', tag = 'Ändbeslag, Räckhållare', meta_title = 'Ändbeslag - Räckhållare', meta_description = 'Ändbeslag - Räckhållare', meta_keyword = 'Ändbeslag - Räckhållare' in /Users/mine/Sites/opencart/system/library/db/mysqli.php on line 41Notice: Error: Duplicate entry '0-0' for key 'PRIMARY'
Error No: 1062

INSERT INTO adam_product_to_store SET product_id = '0', store_id = '0' in /Users/mine/Sites/opencart/system/library/db/mysqli.php on line 41Notice: Error: Duplicate entry '0-0' for key 'PRIMARY'
Error No: 1062

INSERT INTO adam_product_to_layout SET product_id = '0', store_id = '0', layout_id = '0' in /Users/mine/Sites/opencart/system/library/db/mysqli.php on line 41Warning: Cannot modify header information - headers already sent by (output started at /Users/mine/Sites/opencart/admin/index.php:80) in /Users/mine/Sites/opencart/system/library/response.php on line 12

----

A dump of the table looks like this:

----

CREATE TABLE `adam_product` (
`product_id` int(11) NOT NULL,
`model` varchar(64) NOT NULL,
`sku` varchar(64) NOT NULL,
`upc` varchar(12) NOT NULL,
`ean` varchar(14) NOT NULL,
`jan` varchar(13) NOT NULL,
`isbn` varchar(17) NOT NULL,
`mpn` varchar(64) NOT NULL,
`location` varchar(128) NOT NULL,
`quantity` int(4) NOT NULL DEFAULT '0',
`stock_status_id` int(11) NOT NULL,
`image` varchar(255) DEFAULT NULL,
`manufacturer_id` int(11) NOT NULL,
`shipping` tinyint(1) NOT NULL DEFAULT '1',
`price` decimal(15,4) NOT NULL DEFAULT '0.0000',
`points` int(8) NOT NULL DEFAULT '0',
`tax_class_id` int(11) NOT NULL,
`date_available` date NOT NULL DEFAULT '0000-00-00',
`weight` decimal(15,8) NOT NULL DEFAULT '0.00000000',
`weight_class_id` int(11) NOT NULL DEFAULT '0',
`length` decimal(15,8) NOT NULL DEFAULT '0.00000000',
`width` decimal(15,8) NOT NULL DEFAULT '0.00000000',
`height` decimal(15,8) NOT NULL DEFAULT '0.00000000',
`length_class_id` int(11) NOT NULL DEFAULT '0',
`subtract` tinyint(1) NOT NULL DEFAULT '1',
`minimum` int(11) NOT NULL DEFAULT '1',
`sort_order` int(11) NOT NULL DEFAULT '0',
`status` tinyint(1) NOT NULL DEFAULT '0',
`viewed` int(5) NOT NULL DEFAULT '0',
`date_added` datetime NOT NULL,
`date_modified` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

----

As I understand, the "product_id" won't create unique ID:s. Need to be Primary Key. But when I try (in phpMyAdmin) I get the 1062 error again. Same if I try making the column "Unique".

Would be awesome if someone here could help me remedy this....

Thanks
Dan

Options: ReplyQuote


Subject
Written By
Posted
Error 1062
July 26, 2018 04:50AM
July 26, 2018 07:22AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.