Duplicate entry '213' for key 'PRIMARY'

Asked

Viewed 459 times

0

Where is the error? Duplicate entry '213' for key 'PRIMARY'

CREATE TABLE IF NOT EXISTS `%%PREFIX%%shipping_vars` (
  `variableid` int(11) NOT NULL auto_increment,
  `methodid` int(10) unsigned NOT NULL default '0',
  `zoneid` int(10) unsigned NOT NULL default '0',
  `modulename` varchar(100) NOT NULL default '',
  `variablename` varchar(100) NOT NULL default '',
  `variableval` text,
  `varvendorid` int unsigned NOT NULL default '0',
  PRIMARY KEY  (`variableid`),
  KEY `modulename` (`modulename`)
) TYPE=MyISAM  DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;

INSERT INTO `%%PREFIX%%shipping_vars` (`variableid`, `methodid`, `zoneid`, `modulename`, `variablename`, `variableval`, `varvendorid`) VALUES
(213, 19, 1, 'shipping_correios', 'meios', '40010', 0),
(211, 19, 1, 'shipping_correios', 'senha', '', 0),
(212, 19, 1, 'shipping_correios', 'meios', '41106', 0),
(210, 19, 1, 'shipping_correios', 'id', '', 0),
(209, 19, 1, 'shipping_correios', 'displayname', 'Correios', 0),
(208, 19, 1, 'shipping_correios', 'is_setup', '1', 0);

I am trying to install this DB but from this error Duplicate entry '213' for key 'PRIMARY'.

  • It worked normally: http://sqlfiddle.com/#! 2/ef888, but Voce defined that variableid is auto_increment, but in Insert is assigning values to it

1 answer

1

CREATE TABLE IF NOT EXISTS `%%PREFIX%%shipping_vars` (

It is a command that is ignored if the table already exists, so what happens is this table already exists

And the values of Insert are already in the table, as it is likely that you have tried before.

If you check using phpmyadmin you will see that the data is already there.

Should you want to reinstall, you will have to clear the table, or delete it

Browser other questions tagged

You are not signed in. Login or sign up in order to post.