Forums / General Questions / PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

Views: 5,673

Results 1 to 15 of 15
18 Oct 2012, 8:12 PM
#1
dopefish avatar

dopefish

New Zenner

Join Date:
Feb 2012
Posts:
24
Plugin Contributions:
0

PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

Hi everyone, I have a fairly fresh install of zencart 151, I only have ckeditor and usps united states postal service plugins installed, when I go to "option name manager" and enter "color" as dropdown then go to "option value manager" and enter "white" all I get is this error

WARNING: An Error occurred, please refresh the page and try again.

I looked into the log and it gave me the following.......

[18-Oct-2012 14:03:31] PHP Fatal error: 1062: Duplicate entry '1-1' for key 'PRIMARY' :: insert into zen_products_options_values
(products_options_values_id, language_id, products_options_values_name, products_options_values_sort_order)
values ('1',
'1',
'White',
'0') in /home/lazer/public_html/includes/classes/db/mysql/query_factory.php on line 120

please help, I have no idea what is wrong.......

Thank you

18 Oct 2012, 8:22 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

Did you empty tables manually in phpMyAdmin to remove original data from the product tables?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

18 Oct 2012, 8:56 PM
#3
drbyte avatar

drbyte

Sensei

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

Re: PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

Was this an import of data from another database?

.
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.

18 Oct 2012, 9:05 PM
#4
dopefish avatar

dopefish

New Zenner

Join Date:
Feb 2012
Posts:
24
Plugin Contributions:
0

Re: PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

I clicked on phpmyadmin what one do I click on from the left side, and once I do how do I empty the original data ?

information_schema
lazer
    _main
    _phpb728
    _zenc718
    _zenc966

thanks

18 Oct 2012, 9:07 PM
#5
drbyte avatar

drbyte

Sensei

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

Re: PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

Um ... nobody is telling you to empty any data.

Ajeh was asking IF you had done anything like that.

Honestly, if you have to ask that question, you really should stop right there and close that window.
Proceeding any further could result in a serious loss of data and thus take your website down.

.
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.

18 Oct 2012, 9:08 PM
#6
dopefish avatar

dopefish

New Zenner

Join Date:
Feb 2012
Posts:
24
Plugin Contributions:
0

Re: PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

I had stablehost do a reset so I could start fresh, I have old backups but I haven't used them, it was simply reset because I wanted to start over with a new business name.

18 Oct 2012, 9:09 PM
#7
dopefish avatar

dopefish

New Zenner

Join Date:
Feb 2012
Posts:
24
Plugin Contributions:
0

Re: PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

lol, ok, I never did that, just installed zencart and began building it :)

18 Oct 2012, 9:25 PM
#8
drbyte avatar

drbyte

Sensei

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

Re: PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

Very odd.

I just set up a fresh install of Zen Cart (using zc_install), no addons/plugins. Just plain install, with Demo products deselected during zc_install.
Log in to my admin.
Go to "option name manager" and enter "color" as dropdown
Then go to "option value manager" and enter "white". No sort order, just left it blank.

No error message. White shows up in the list, designated as a dropdown.

.
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.

18 Oct 2012, 9:40 PM
#9
dopefish avatar

dopefish

New Zenner

Join Date:
Feb 2012
Posts:
24
Plugin Contributions:
0

Re: PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

it just brings me to a blank page with this message "WARNING: An Error occurred, please refresh the page and try again."

this is the link it is pointing at
"options_values_manager.php?action=add_product_option_values&value_page=1

18 Oct 2012, 9:48 PM
#10
drbyte avatar

drbyte

Sensei

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

Re: PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

It bothers me that your database appears to be damaged.

I'm inclined to suggest that a fresh install would be prudent.

.
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.

18 Oct 2012, 10:10 PM
#11
dopefish avatar

dopefish

New Zenner

Join Date:
Feb 2012
Posts:
24
Plugin Contributions:
0

Re: PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

oh........can I backup what I have then uninstall zencart then reinstall and restore or will that simply copy the problem back ?

18 Oct 2012, 10:32 PM
#12
drbyte avatar

drbyte

Sensei

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

Re: PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

If you're talking about backing up everything you see in your admin, then yes a reinstall will wipe that out, and doing a backup and restore will bring that problem back.

Remember: Zen Cart consists of TWO parts: 1: the database, and 2: the PHP files (plus images, css, js, etc files).

As long as you've not installed any plugins that do any database changes, and you know what settings you customized in your admin, the running zc_install to rebuild a fresh clean database will let you start over. You could then redo any SQL changes required by your plugins and redo any admin settings configurations, entering products/categories, etc.

And of course you SHOULD do a database backup (and files backup) beforehand anyway, "just in case". When in doubt, always make a backup first. Doesn't mean you need to ever restore it.

.
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.

18 Oct 2012, 10:45 PM
#13
dopefish avatar

dopefish

New Zenner

Join Date:
Feb 2012
Posts:
24
Plugin Contributions:
0

Re: PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

ok then, I will work on this, where does zen cart save the .php files for main pages and the product pages so I can just copy and paste my descriptions ?

thanks

19 Oct 2012, 1:07 AM
#14
drbyte avatar

drbyte

Sensei

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

Re: PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

Those are in the database.

.
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.

19 Oct 2012, 1:58 AM
#15
dopefish avatar

dopefish

New Zenner

Join Date:
Feb 2012
Posts:
24
Plugin Contributions:
0

Re: PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'

ok, I reinstalled it and its bare bones again but it all works 100% again, I will take it step by step and anything I install or modify I will verify that it still functions properly.

Thank you for your time and help !