Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Dec 2007
    Posts
    32
    Plugin Contributions
    0

    Default Yes, Another "1062 Duplicate entry '0' for key 1" thread!

    Code:
    1062 Duplicate entry '0' for key 1
    in:
    [update fast_whos_online set customer_id = '0', full_name = 'ĄGuest', ip_address = '78.151.199.57', time_last_click = '1199876169', last_page_url = '/cart/index.php?main_page=page&id=16&chapter=0&zenid=5fca194f09b3d02d1cb79a978103c731', host_address = 'OFFICE_IP_TO_HOST_ADDRESS', user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11' where session_id = '5fca194f09b3d02d1cb79a978103c731' and ip_address='78.151.199.57']
    ^^^ Is the error I'm getting a LOT of the time.

    I'm running:

    Zen Cart 1.3.7.1
    PHP 4.4.7
    MySQL 4.0.27

    The problem seems to occur (during testing) because I am accessing a lot of the page from the same I.P address. I think it may be due to me browsing as a ''guest' and the 'whos_online' table not correctly handling the fact that I'm accessing many pages as different 'guests' in a short period of time.

    I've tried a few of the SQL patches to reinstate the auto_increment function but they are of no avail.

    Any help would be appreciated as my cart is ready to go public soon.

    www fastcardirect co uk/cart

  2. #2
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Yes, Another "1062 Duplicate entry '0' for key 1" thread!

    What happens if you "empty" the table using the "Empty" button in phpMyAdmin? Or TRUNCATE it using an SQL statement?

    Perhaps it's got some confusing data in it and needs to start clean.
    .

    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. #3
    Join Date
    Dec 2007
    Posts
    32
    Plugin Contributions
    0

    Default Re: Yes, Another "1062 Duplicate entry '0' for key 1" thread!

    Have gone back and emptied the table, still occasionally giving me the error. When I'm logged into my test account rather than as a guest, it seems to work ok.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Yes, Another "1062 Duplicate entry '0' for key 1" thread!

    Quote Originally Posted by Fastcar View Post
    I'm running:

    Zen Cart 1.3.7.1
    PHP 4.4.7
    MySQL 4.0.27

    ... my cart is ready to go public soon.
    Have you considered upgrading to 1.3.8a before you go live?
    .

    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. #5
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Yes, Another "1062 Duplicate entry '0' for key 1" thread!

    Quote Originally Posted by Fastcar View Post
    Code:
    1062 Duplicate entry '0' for key 1
    in:
    [update fast_whos_online set customer_id = '0', full_name = 'ĄGuest', ip_address = '78.151.199.57', time_last_click = '1199876169', last_page_url = '/cart/index.php?main_page=page&id=16&chapter=0&zenid=5fca194f09b3d02d1cb79a978103c731', host_address = 'OFFICE_IP_TO_HOST_ADDRESS', user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11' where session_id = '5fca194f09b3d02d1cb79a978103c731' and ip_address='78.151.199.57']
    ^^^ Is the error I'm getting a LOT of the time.
    What is the structure of your whos_online table?
    You can get this quickly via phpMyAdmin by clicking on Export, selecting just this table, choosing structure-only, and clicking Go
    .

    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. #6
    Join Date
    Dec 2007
    Posts
    32
    Plugin Contributions
    0

    Default Re: Yes, Another "1062 Duplicate entry '0' for key 1" thread!

    Code:
    -- 
    -- Table structure for table `fast_whos_online`
    -- 
    
    CREATE TABLE `fast_whos_online` (
      `customer_id` int(225) NOT NULL auto_increment,
      `full_name` varchar(64) NOT NULL default '',
      `session_id` varchar(128) NOT NULL default '',
      `ip_address` varchar(15) NOT NULL default '',
      `time_entry` varchar(14) NOT NULL default '',
      `time_last_click` varchar(14) NOT NULL default '',
      `last_page_url` varchar(255) NOT NULL default '',
      `host_address` text NOT NULL,
      `user_agent` varchar(255) NOT NULL default '',
      PRIMARY KEY  (`customer_id`),
      KEY `idx_ip_address_zen` (`ip_address`),
      KEY `idx_session_id_zen` (`session_id`),
      KEY `idx_customer_id_zen` (`customer_id`),
      KEY `idx_time_entry_zen` (`time_entry`),
      KEY `idx_time_last_click_zen` (`time_last_click`),
      KEY `idx_last_page_url_zen` (`last_page_url`)
    ) TYPE=MyISAM AUTO_INCREMENT=48 ;
    
    -- 
    -- Dumping data for table `fast_whos_online`
    -- 
    
    INSERT INTO `fast_whos_online` VALUES (0, '¥Spider', '', '66.249.72.164', '1200040570', '1200042434', '/cart/index.php?main_page=product_info&cPath=92&products_id=337', 'OFFICE_IP_TO_HOST_ADDRESS', 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');
    INSERT INTO `fast_whos_online` VALUES (46, '¥Guest', 'a1a2bac7c46a3b0a12fed65154f6f2ca', '78.151.219.83', '1200042633', '1200042633', '/', 'OFFICE_IP_TO_HOST_ADDRESS', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11');
    INSERT INTO `fast_whos_online` VALUES (47, '¥Guest', '09a2c4c423503f00133368758b2e72ad', '84.45.139.35', '1200042857', '1200042857', '/', 'OFFICE_IP_TO_HOST_ADDRESS', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322)');
    Also, I get this error message when there is a googlebot crawling the cart. It's as though there is only a few connections allowed at a time and thus, after 2-4 everything gets locked up.
    Last edited by Fastcar; 11 Jan 2008 at 10:19 AM.

  7. #7
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Yes, Another "1062 Duplicate entry '0' for key 1" thread!

    Quote Originally Posted by Fastcar View Post
    `customer_id` int(225) NOT NULL auto_increment,
    Your customer_id field should not be auto_increment ... that's what's causing your headaches.
    With phpMyAdmin you should be able to Edit your table settings and uncheck the auto-increment option (or deselect it from pulldown, etc).
    .

    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.

  8. #8
    Join Date
    Dec 2007
    Posts
    32
    Plugin Contributions
    0

    Default Re: Yes, Another "1062 Duplicate entry '0' for key 1" thread!

    Have just gone and changed that, will see in the next couple of days if it solves the issue. I trust your advice and thank you in advance.

  9. #9
    Join Date
    Dec 2007
    Posts
    32
    Plugin Contributions
    0

    Default Re: Yes, Another "1062 Duplicate entry '0' for key 1" thread!

    DrByte unfortunately that did not seem to fix the problem, are there other suggestions I should try?

  10. #10
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Yes, Another "1062 Duplicate entry '0' for key 1" thread!

    Quote Originally Posted by Fastcar View Post
    Code:
    ,
      PRIMARY KEY  (`customer_id`),
    I must be really blind ... and missed this one the last time round.
    This table should not have a primary key.
    And, since you've got one set, it's forcing uniqueness on every "0" record, which would happen for every "guest"/visitor.

    Drop your primary key from that table.
    You could use the following via the SQL Patch tool:
    Code:
    ALTER TABLE whos_online DROP PRIMARY KEY;
    or add your fast_ prefix and do it in phpMyAdmin.
    .

    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.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 15 Jul 2012, 01:24 PM
  2. 1062 Duplicate entry '1-1' for key 1 ????
    By eggrush in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 20 Oct 2010, 06:03 PM
  3. 1062 Duplicate entry '0' for key 1 in "search_log"
    By samar777 in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 11 Feb 2010, 06:50 PM
  4. 1062 Duplicate entry '' for key 2
    By Shavelieva in forum General Questions
    Replies: 0
    Last Post: 17 Nov 2007, 06:07 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