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
Re: PHP Fatal error: 1062uplicate entry '0' for key 'PRIMARY'
Quote:
Originally Posted by
mydakota
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
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.
Re: PHP Fatal error: 1062uplicate entry '0' for key 'PRIMARY'
Quote:
Originally Posted by
mydakota
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.
Re: PHP Fatal error: 1062uplicate entry '0' for key 'PRIMARY'
Quote:
Originally Posted by
mc12345678
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.
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
Re: PHP Fatal error: 1062uplicate entry '0' for key 'PRIMARY'
Quote:
Originally Posted by
mydakota
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.
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
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
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.)
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 .