Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 2 votes

1062 Duplicate Entry Error Fix


50 replies to this topic

#41 dany_134

  • Community Member
  • 1 posts
  • Real Name:Danilo

Posted 14 February 2009, 10:52

Hi all. I experienced the same problem yesterday. The log is below:

1062 - Duplicate entry 'li20tl2he6pen6fd35vtpm5q75' for key 1

insert into sessions values ('li20tl2he6pen6fd35vtpm5q75', '1234550946', 'language|s:7:\"english\";languages_id|s:1:\"1\";selected_box|s:13:\"configuration\";')


Using my phpmyadmin 2.11.9 I looked for the "sessions" configuration and noticed that the index value for the utilized space was corrupted and red colored.
I used the phpmyadmin optimizer. The index was dimensioned to 4,096 B, black colored, and the problem was solved.

Hope this can help you.

#42 kyli51

  • Community Member
  • 7 posts
  • Real Name:romain dupuy

Posted 24 March 2009, 12:35

Hello all,

i have the same problem...for some reasons, i cannot edit a product..i can add it to multiple categories (usine Multiplecategories mod) but when i try to edit the product i get the following error :

1062 - Duplicate entry '38-26' for key 1

insert into products_to_categories (products_id, categories_id) values ('38', '26')

[TEP STOP]

and obviously it does not record my changes...i went trough the forums and tryed various solutions including those on this topic ..but did not work out..

any ideas ?

Kyli

#43 supernoc

  • Community Member
  • 124 posts
  • Real Name:supernoc
  • Gender:Male
  • Location:Wisconsin, USA

Posted 08 April 2009, 00:39

View Postdany_134, on Feb 14 2009, 11:52 AM, said:

Hi all. I experienced the same problem yesterday. The log is below:

1062 - Duplicate entry 'li20tl2he6pen6fd35vtpm5q75' for key 1

insert into sessions values ('li20tl2he6pen6fd35vtpm5q75', '1234550946', 'language|s:7:\"english\";languages_id|s:1:\"1\";selected_box|s:13:\"configuration\";')


Using my phpmyadmin 2.11.9 I looked for the "sessions" configuration and noticed that the index value for the utilized space was corrupted and red colored.
I used the phpmyadmin optimizer. The index was dimensioned to 4,096 B, black colored, and the problem was solved.

Hope this can help you.

This worked for me.

#44 bhavatmaj

  • Community Member
  • 53 posts
  • Real Name:Bhavatmaj
  • Gender:Male
  • Location:India

Posted 22 April 2009, 06:34

thanks
bhavatmaj

#45 danigirl168

  • Community Member
  • 10 posts
  • Real Name:Danielle Richwoods
  • Location:London

Posted 27 April 2009, 11:54

Hi all,

I had the following on a client's site that was running a clean OsC2.2 which I then added the SPPC mod to:

Quote

1062 - Duplicate entry '0-133' for key 1

insert into products_groups (customers_group_id, customers_group_price, products_id) values ('', '', '133')

[TEP STOP]

This error occured when the client tried to use the duplicate product function. After reading this thread about 10 times over along with a lot of other forums posts elsewhere on 1062s, I saw the pattern between everyone's error and worked out why my client was getting his.

As I understand a 1062 happens because somewhere in your database a field is not auto-incrementing when it should be. The error tells you which database table to look in (in the case I quote above it was products_groups). Try setting the first field (in this case customers_group_id) to auto-increment. This will then prevent the duplicate entries. I hope that helps those of you that are having trouble.

Happy OsC'ing,

Dani

Edited by danigirl168, 27 April 2009, 11:54.

There are 3 types of people - those who can count, and those who can't.

#46 ZapMe1

  • Community Member
  • 23 posts
  • Real Name:Joe

Posted 31 July 2009, 19:20

I get the same error with products_to_categories.... I tried your "auto-increment" change, and that "moved" the error to the customer_group DB!

The error happens when I try to add a new, or update an existing product!

Any other solutions?

1062 - Duplicate entry '0-0' for key 1

insert into products_to_categories (products_id, categories_id) values ('0', '0')

[TEP STOP]


I've narrowed it to "admin/categories.php... Started after installing the SPPC mod!

View Postdanigirl168, on Apr 27 2009, 07:54 AM, said:

Hi all,

I had the following on a client's site that was running a clean OsC2.2 which I then added the SPPC mod to:



This error occured when the client tried to use the duplicate product function. After reading this thread about 10 times over along with a lot of other forums posts elsewhere on 1062s, I saw the pattern between everyone's error and worked out why my client was getting his.

As I understand a 1062 happens because somewhere in your database a field is not auto-incrementing when it should be. The error tells you which database table to look in (in the case I quote above it was products_groups). Try setting the first field (in this case customers_group_id) to auto-increment. This will then prevent the duplicate entries. I hope that helps those of you that are having trouble.

Happy OsC'ing,

Dani


#47 skhuu

  • Community Member
  • 36 posts
  • Real Name:Sipho

Posted 20 February 2011, 17:13

I tried the fix and when I click on save I get this error, I tried many times over and it doesnt work.

Error
SQL query:

ALTER TABLE `sessions` CHANGE `sesskey` `sesskey` INT( 32 ) NOT NULL

MySQL said:

#1062 - Duplicate entry '0' for key 1

Does anyone know why I get this?

#48 BdMdesigN

  • Community Member
  • 15 posts
  • Real Name:Peter Stein
  • Gender:Male
  • Location:Winsen (Luhe) Germany

Posted 30 July 2011, 12:25

Thx 4 this fix, works fine.

If you have problems and cant use your mysqladmin/phpmysqladmin or other mysql server software corectly,

dump the sessions table with this code:

DROP TABLE IF EXISTS sessions;

CREATE TABLE sessions (
  sesskey int(32) NOT NULL auto_increment,
  expiry int(11) unsigned NOT NULL,
  value text NOT NULL,
  PRIMARY KEY (sesskey)
);

If you are done, delete the osc Cokkies in your browser, reload the side and WOW ... ^^

Best regards Peter

"Edit: one ask i have about this error: on the 2.2RC2a i dont get this error with this sessions table:

CREATE TABLE `sessions` (
  `sesskey` varchar(32) NOT NULL default '',
  `expiry` int(11) unsigned NOT NULL default '0',
  `value` text NOT NULL,
  PRIMARY KEY  (`sesskey`)
) ENGINE=MyISAM;

So i wonder me now :huh:

Edit end

Edited by BdMdesigN, 30 July 2011, 12:39.


#49 BdMdesigN

  • Community Member
  • 15 posts
  • Real Name:Peter Stein
  • Gender:Male
  • Location:Winsen (Luhe) Germany

Posted 30 July 2011, 13:08

Upppsss:

Now after this fix, i cant go on the Admin Page: Cookie problems ?!?

"Fehler: Umleitungsfehler

Die aufgerufene Website leitet die Anfrage so um, dass sie nie beendet werden kann.

* Dieses Problem kann manchmal auftreten, wenn Cookies deaktiviert oder abgelehnt werden."

#50 BdMdesigN

  • Community Member
  • 15 posts
  • Real Name:Peter Stein
  • Gender:Male
  • Location:Winsen (Luhe) Germany

Posted 30 July 2011, 17:39

View PostBdMdesigN, on 30 July 2011, 13:08, said:

Upppsss:

Now after this fix, i cant go on the Admin Page: Cookie problems ?!?

"Fehler: Umleitungsfehler

Die aufgerufene Website leitet die Anfrage so um, dass sie nie beendet werden kann.

* Dieses Problem kann manchmal auftreten, wenn Cookies deaktiviert oder abgelehnt werden."

Im again, ok i have update my php5 Version to 5.3.7RC4-dev (Zend: 2.3.0), downloaded the osc 2.3.1 again today, delete all files on space, DB Tables and cookies in Browser, install again and its works (DB fix inclusive).

#51 geomilli

  • Community Member
  • 31 posts
  • Real Name:George Milligan
  • Gender:Male
  • Location:Danbury, Connecticut USA

Posted 04 February 2012, 23:55

Here is my error I was getting and then went about using Peter's addition:

1062 - Duplicate entry '367-2' for key 1
insert into products_description (products_name, products_description, products_url, products_id, language_id) values ('', '', '', '367', '2')
[TEP STOP]

Peter you missed a beat.

This works well by emptying out the sessions and renew the DB. However, when you added the entries back you didn't specify what Collation. I don't believe the sesskey should be INT or auto_increment, the security is certianly an issue. So, here is what I did once the DB was refreshed using Peter's suggestion:

Change sesskey to Type: VARCHAR, Length/Values: 64, Collation: latin1_swedish_ci and that's it! Nothing else. As you can see I sent the Length/Values up to 64, based upon the rest of the forums suggestion. This fixed the problem for me, hope it helps someone else!

Edited by geomilli, 04 February 2012, 23:56.