Zen Cart Logo
Forums / General Questions / 1062 Duplicate entry '0' for key 1 after export/import of database

1062 Duplicate entry '0' for key 1 after export/import of database

Locked

Views: 62,224

Results 21 to 38 of 38
This thread is locked. New replies are disabled.
29 Jun 2006, 12:57 AM
#21
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

1062 Duplicate entry '0' for key 1 after export/import of database

cshart:

I am experiencing this problem in my admin area when I try to go anywhere.

What can be done to correct this?

cshart

  1. Run the SQL statements above, via phpMyAdmin
  2. Use phpMyAdmin to do a Database Backup, and then click on the admin_activity_log table and click the "Empty" button.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

3 Feb 2007, 3:10 AM
#22
jdimaging avatar

jdimaging

New Zenner

Join Date:
Nov 2005
Posts:
22
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

Dr. Byte, thank you so much for this script. I have spent the last week moving sites and this overwhelmed me. I found your script, ran it and voila. Thank you.

Darlene

4 Aug 2007, 9:09 PM
#23
ljdream00 avatar

ljdream00

Zen Follower

Join Date:
Jun 2007
Location:
Michigan
Posts:
168
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

:clap: Dr. Byte.... You are the Greatest:clap:. your script fixed my issue. Thanks

Zencart Websites I've Designed:
deejaycentipede(DOT)com
djellery216(DOT)com

21 Sep 2007, 5:52 PM
#24
tigergirl avatar

tigergirl

New Zenner

Join Date:
Aug 2007
Posts:
29
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

DrByte:

  1. Run the SQL statements above, via phpMyAdmin
  2. Use phpMyAdmin to do a Database Backup, and then click on the admin_activity_log table and click the "Empty" button.

Thank you so much DrByte! I just had to do this and it worked PERFECTLY! :clap::clap::clap: You're a sanity saver!
Leah

9 Dec 2007, 7:14 PM
#25
virtualahmad avatar

virtualahmad

Zen Follower

Join Date:
Jan 2006
Location:
Toronto, Ontario, Canada
Posts:
179
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

jdimaging:

Dr. Byte, thank you so much for this script. I have spent the last week moving sites and this overwhelmed me. I found your script, ran it and voila. Thank you.

Darlene

Ditto !

:clap:

Ahmad Rahman
TRUST IT | web site design and development
mobile: 416.828.0224 | email: [email protected]
www.trustit.ca

For IT solutions how you want IT, when you want IT, TRUST IT.

23 Apr 2008, 6:09 PM
#26
drbyday avatar

drbyday

New Zenner

Join Date:
Mar 2008
Posts:
50
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

Drbyte!

Please can you create a SQL command for phpmyadmin for zencart version 1.2.1?

Please, I would really appreciate it.

28 Jun 2008, 9:23 PM
#27
lloydr avatar

lloydr

New Zenner

Join Date:
Jun 2007
Location:
SA
Posts:
91
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

Hi All

I could really use some help with my issue:
1062 Duplicate entry '0' for key 1
in:
[insert into banners_history (banners_id, banners_shown, banners_history_date) values ('52', 1, now())]

Link to my site:
http://www.digitalsaonline.co.za/catalog/

I have done everything on this forum as suggested and still having the same issue

I have cleared history on all tables that i could find listed here, have run the SQL script and have gone and DEL all my banners in PHPmyAdmin

What else do i need to do to fix this

Issue is coming up in both site and admin

Admin error is:
1062 Duplicate entry '0' for key 1
in:
[insert into admin_activity_log (access_date, admin_id, page_accessed, page_parameters, ip_address) values (now(), '1', 'store_manager.php', '', '198.54.202.30')]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

All help appreciated

Thanks

29 Jun 2008, 5:21 AM
#28
lloydr avatar

lloydr

New Zenner

Join Date:
Jun 2007
Location:
SA
Posts:
91
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

Hi All

Any update please or help on my post?

29 Jun 2008, 5:34 AM
#29
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

When did this start happening?
How does that relate to things done to your webserver or your site or your database or your hosting account?
What version of Zen Cart? Is this an upgrade? from which version(s)? When?
What addons do you have installed?

Side-note: the proper etiquette for "bumping" your post is to post more information about the problem, not just say "help". Related info: http://www.zen-cart.com/forum/faq.php?faq=vb_faq#faq_do_and_dont

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

29 Jun 2008, 6:07 AM
#30
lloydr avatar

lloydr

New Zenner

Join Date:
Jun 2007
Location:
SA
Posts:
91
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

DrByte:

When did this start happening?
How does that relate to things done to your webserver or your site or your database or your hosting account?
What version of Zen Cart? Is this an upgrade? from which version(s)? When?
What addons do you have installed?

Side-note: the proper etiquette for "bumping" your post is to post more information about the problem, not just say "help". Related info: http://www.zen-cart.com/forum/faq.php?faq=vb_faq#faq_do_and_dont

Thank you so much for the reply
My site generates income for my family and really need to get it working for my clients to purchase from me from tomorrow

It started yesterday
Not sure i understand your second ?
Not an upgrade, its a install from zencart zip files, version "New Version Available v1.3.8" so i think its version 1.3.7
Started my site a year ago and moved to new hosting company about 5 months ago, all has been working fine
Add ons:
I think the cart editor addon, allows me to edit client orders, thats about it

Thanks again for the reply

29 Jun 2008, 7:41 AM
#31
lloydr avatar

lloydr

New Zenner

Join Date:
Jun 2007
Location:
SA
Posts:
91
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

Sorry about that here is some more info:
You should include:
a- The version of Zen Cart you are using and whether this is a new install or an upgrade.
I think im on version 1.3.7, new install

b- A list of all the addons/contributions you have installed, and any kinds of customizations you've made to your site.
Cart Editor nothing else

c- The type of server you are using and, if you are installing locally, the operating system
This i dont know, i do know my site is hosted in Florida on Linux server

d- The version of PHP installed on the server
phpMyAdmin - 2.8.2.4

e- The version of MYSQL installed on the server
MySQL - 4.1.20

f- Details of exactly what you were doing when your problem occurred.
I logged into the site and found the error

29 Jun 2008, 11:08 AM
#33
lloydr avatar

lloydr

New Zenner

Join Date:
Jun 2007
Location:
SA
Posts:
91
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

Hi All again
I have PMed DrByte for some help but will post my PM here as well, maybe some one can see something i dont as im new to MySQL and have no idea what im looking for:

Please see below for things I have found that look a bit odd while checking each tables “Auto_Increment” is on and that the Next Autoindex number is correct when checking against the primary field under the browse option for that table :
· email_archive table - not found in mysql
· featured table shows value 11 for Next Autoindex but the browse option is greyed out
· products_attributes table shows value 1,104 for Next Autoindex but browse button greyed out
· specials table shows value 51 for the Next Autoindex but browse button greyed out
· banners table shows value 56 for the Next Autoindex but browse button greyed out
· configuration table shows the following warning UNIQUE and INDEX keys should not both be set for column configuration_key
PS – I have also checked the updated SQL script in the Zen Cart 1.3.8 zip files
Some other details:
Site: http://www.digitalsaonline.co.za/catalog/
MySQL - 4.1.20
phpMyAdmin - 2.8.2.4
Error occurred on the: 28th June 2008
System Changes: none what so every prior to error, apart from new banners:
Other errors:
Site:
1062 Duplicate entry '0' for key 1
in:
[insert into banners_history (banners_id, banners_shown, banners_history_date) values ('55', 1, now())]

Admin:
1062 Duplicate entry '0' for key 1
in:
[insert into admin_activity_log (access_date, admin_id, page_accessed, page_parameters, ip_address) values (now(), '1', 'store_manager.php', '', '198.54.202.30')]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

29 Jun 2008, 11:18 PM
#34
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

LloydR:

Here is a link to a screenshot of the admin_activity_log

http://img262.imageshack.us/img262/1695/adminactivityloggj1.jpg

Does any thing look odd?

Yes ... why is the table empty (0 rows) and created today?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

29 Jun 2008, 11:28 PM
#35
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

LloydR:

Please see below for things I have found that look a bit odd while checking each tables “Auto_Increment” is on and that the Next Autoindex number is correct when checking against the primary field under the browse option for that table :
· featured table shows value 11 for Next Autoindex but the browse option is greyed out
· products_attributes table shows value 1,104 for Next Autoindex but browse button greyed out
· specials table shows value 51 for the Next Autoindex but browse button greyed out
· banners table shows value 56 for the Next Autoindex but browse button greyed outIf the browse button is greyed out, that means there's no data in the table to be browsed

LloydR:

· email_archive table - not found in mysqlIf you're not archiving any emails then that won't matter. But it begs the question of "how" did it disappear? If it's missing during a database-upgrade, you may run into errors that will cause upgrade challenges since it will have to abort mid-stream. Thus I suggest that you recreate it perhaps from a backup.

LloydR:

· configuration table shows the following warning UNIQUE and INDEX keys should not both be set for column configuration_keyThat's normal, and can be ignored.

LloydR:

1062 Duplicate entry '0' for key 1
in:
[insert into banners_history (banners_id, banners_shown, banners_history_date) values ('55', 1, now())]
"key 1" is probably the primary key on the table, which would be the banners_history_id field.
Since the "insert" statement doesn't mention that field (and this is normal and desired), it is expecting the auto-increment attribute of that field to automatically select the correct next number. So, if you're getting that error on that table, it means the banners_history_id is not set to autoincrement.

LloydR:

Admin:
1062 Duplicate entry '0' for key 1
in:
[insert into admin_activity_log (access_date, admin_id, page_accessed, page_parameters, ip_address) values (now(), '1', 'store_manager.php', '', '198.54.202.30')]
Same issue as mentioned above for banners_history table.

If it was working flawlessly until a certain date, then unless it's something you or your staff have done to the site, your first line of support for these odd database issues should be your hosting company -- so they can investigate what may be wrong on the server to break the autoincrement funcitonality.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

30 Jun 2008, 5:59 AM
#36
lloydr avatar

lloydr

New Zenner

Join Date:
Jun 2007
Location:
SA
Posts:
91
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

DrByte:

Yes ... why is the table empty (0 rows) and created today?

I clicked on empty, could that be the issue?

Thanks for the reply

30 Jun 2008, 6:16 AM
#37
lloydr avatar

lloydr

New Zenner

Join Date:
Jun 2007
Location:
SA
Posts:
91
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

Great my hosting company changed servers with our telling me, how nice of them

So i worked in the wrong DB the whole week end

Thanks for the help DrByte

7 Jul 2008, 6:17 PM
#38
warehousemultimedia avatar

warehousemultimedia

New Zenner

Join Date:
Jun 2008
Posts:
2
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1 after export/import of database

The problem for me was that there were still entries for old customers sitting in the "customer_info" table. I dropped that and started my 'customers_id' field in the "customers" table at 1 again and it works great. Hope this helps someone.