Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 35
  1. #21
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    Default Re: PHP Fatal error: 1062uplicate entry '0' for key 'PRIMARY'

    ok by running the query i get this response
    NO_AUTO_VALUE_ON_ZERO,ERROR_FOR_DIVISION_BY_ZERO,N...
    so seems to be the issue i might try and change the 0 to null and see what happens lol otherwise guess its up to the hosting company to resolve if they even come to the party on that who would know

  2. #22
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: PHP Fatal error: 1062uplicate entry '0' for key 'PRIMARY'

    Quote Originally Posted by mydakota View Post
    ok by running the query i get this response
    NO_AUTO_VALUE_ON_ZERO,ERROR_FOR_DIVISION_BY_ZERO,N...
    so seems to be the issue i might try and change the 0 to null and see what happens lol otherwise guess its up to the hosting company to resolve if they even come to the party on that who would know
    Changing '0' for NULL may have unwanted implications in the rest of the code. They are not the same thing, and may give different return values in queries, and php code.
    I think it is safer to talk to your hosting company

  3. #23
    Join Date
    Jul 2012
    Posts
    16,799
    Plugin Contributions
    17

    Default Re: PHP Fatal error: 1062uplicate entry '0' for key 'PRIMARY'

    I would agree that the best solution (as one has already chimed in as having the same problem with the same host) if staying with this host would be to get the server settings fixed. The best solution for you as a store operator is to find someone that supports ZC/doesnt have this issue.

    With regards to a solution associated with staying with this host in absence of them resolving the above issue, I've been looking for a post DrByte made about I think it was Windows servers... Regardless if it was windows or another server, there was something about switching assignments from 0 to null as 0 is a specific "integer" designation, while null is nothing and an auto-increment field should not allow NULL as a value and thus should auto-increment. That said, not including the auto-increment field in the assignment query also would force the auto-increment to occur.

    So in this case:
    Code:
     $db->Execute("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " (products_attributes_id, products_id, options_id, options_values_id, options_values_price, price_prefix, products_options_sort_order, product_attribute_is_free, products_attributes_weight, products_attributes_weight_prefix, attributes_display_only, attributes_default, attributes_discounted, attributes_image, attributes_price_base_included, attributes_price_onetime, attributes_price_factor, attributes_price_factor_offset, attributes_price_factor_onetime, attributes_price_factor_onetime_offset, attributes_qty_prices, attributes_qty_prices_onetime, attributes_price_words, attributes_price_words_free, attributes_price_letters, attributes_price_letters_free, attributes_required)
                              values (0,
                                      '" . (int)$products_id . "',
                                      '" . (int)$options_id . "',
    If it were modified to:
    Code:
     $db->Execute("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " (products_id, options_id, options_values_id, options_values_price, price_prefix, products_options_sort_order, product_attribute_is_free, products_attributes_weight, products_attributes_weight_prefix, attributes_display_only, attributes_default, attributes_discounted, attributes_image, attributes_price_base_included, attributes_price_onetime, attributes_price_factor, attributes_price_factor_offset, attributes_price_factor_onetime, attributes_price_factor_onetime_offset, attributes_qty_prices, attributes_qty_prices_onetime, attributes_price_words, attributes_price_words_free, attributes_price_letters, attributes_price_letters_free, attributes_required)
                              values (
                                      '" . (int)$products_id . "',
                                      '" . (int)$options_id . "',
    Removing reference to: products_attributes_id
    The problem would not exist in thisquery, but other related queries would also need to be modified.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #24
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: PHP Fatal error: 1062uplicate entry '0' for key 'PRIMARY'

    Quote Originally Posted by mydakota View Post
    ok by running the query i get this response
    NO_AUTO_VALUE_ON_ZERO,ERROR_FOR_DIVISION_BY_ZERO,N...
    so seems to be the issue i might try and change the 0 to null and see what happens lol otherwise guess its up to the hosting company to resolve if they even come to the party on that who would know
    Yours is the only site I've ever seen use that setting in 14 years. Zen Cart was not designed with that setting in mind. You'll need to remove that setting from your MySQL configuration, via your hosting company.
    .

    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.

  5. #25
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: PHP Fatal error: 1062uplicate entry '0' for key 'PRIMARY'

    Quote Originally Posted by mc12345678 View Post
    null is nothing and an auto-increment field should not allow NULL as a value and thus should auto-increment. That said, not including the auto-increment field in the assignment query also would force the auto-increment to occur.
    Yes, and my nature, an auto-increment field is an integer value. It's *extremely* rare to ever use a 0 in an auto-increment field. It's certainly not something a shared-host should allow as a default.
    .

    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.

  6. #26
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    Default Re: PHP Fatal error: 1062uplicate entry '0' for key 'PRIMARY'

    Lol no luck with them this is one of there responses We apologize that you had to contact us and the team member that was assisting you earlier is asking for the version of your sql and is waiting for a response. Our Specialists stated that the issue was caused by the table itself.
    When I called them all they could say as its not a issue with there server/database lol how can it not be when I can use the exact same backups and restore to a different server and it works . I even tryed making a new ZenCart install and just backing up the attribute tables and importing them to my issue site still same results . I now know why they call themselves CrazyDomains lol because of there crazy servers

  7. #27
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: PHP Fatal error: 1062uplicate entry '0' for key 'PRIMARY'

    Quote Originally Posted by mydakota View Post
    I now know why they call themselves CrazyDomains
    When I first read your post I thought you where joking calling them that. But if it's a real name, it wouldn't be on my first choices.
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

  8. #28
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    Default Re: PHP Fatal error: 1062uplicate entry '0' for key 'PRIMARY'

    Doubt the will give my money back but if they don't do the right thing I at least make sure people know to avoid them

  9. #29
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: PHP Fatal error: 1062uplicate entry '0' for key 'PRIMARY'

    1. Perhaps you can log a support ticket and ask them to turn off the NO_AUTO_VALUE_ON_ZERO setting, instead of tying it to a specific issue that they've been seeing as "someone else's problem".

    2. Or, if you can find out the complete result of this (instead of the chopped-off version which you posted), then we can tell your Zen Cart to use all the rest of the (applicable) settings:
    Quote Originally Posted by mydakota View Post
    ok by running the query i get this response
    NO_AUTO_VALUE_ON_ZERO,ERROR_FOR_DIVISION_BY_ZERO,N...
    so seems to be the issue i might try and change the 0 to null and see what happens lol otherwise guess its up to the hosting company to resolve if they even come to the party on that who would know
    (Once you post the complete output of that sql_mode query, I'll show you how to tell ZC what to do with those.)
    .

    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.

  10. #30
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    Default Re: PHP Fatal error: 1062uplicate entry '0' for key 'PRIMARY'

    magically i get home and start playing and it is fixed hmmmm seems someone has fixed it very strange must have been the hosting company i will try find out what they did to fix it but i guess you guys probably know what they did anyhow but I would like to confirm it .

 

 
Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Replies: 3
    Last Post: 21 Jan 2016, 10:35 PM
  2. v151 PHP Fatal error 1062: Duplicate entry '2147483647' for key 1
    By NoobGal in forum General Questions
    Replies: 5
    Last Post: 20 Jan 2013, 05:36 PM
  3. Replies: 2
    Last Post: 11 Dec 2012, 03:58 AM
  4. v151 PHP Fatal error:1062:Duplicate entry '1-1' for key 'PRIMARY'
    By Dopefish in forum General Questions
    Replies: 14
    Last Post: 19 Oct 2012, 02:58 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR