Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2006
    Posts
    76
    Plugin Contributions
    0

    Default 1062 Duplicate entry '38' for key 1

    A new customer signed up with my cart today and he said that every time he tried to order, after filling up information he ended up with the message:

    1062 Duplicate entry '38' for key 1
    in:
    [insert into customers_basket (customers_id, products_id,
    customers_basket_quantity, customers_basket_date_added) values ('127',
    '789', '1', '20080115')]

    There's no other customer after him yet so I don't know what will happen to the next one. Can someone give me some information about this? Thanks.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: 1062 Duplicate entry '38' for key 1

    You have probably done some sort of database backup/restore which has lost some settings or corrupted data.

    The fastest (although not really the most recommended) way to fix it is to rebuild the table with the right structure.
    The following will LOSE ALL YOUR CUSTOMER BASKET DATA, but should get rid of the error.
    You can do this via the Admin->Tools->Install SQL Patch option, or via phpMyAdmin:
    Code:
    DROP TABLE IF EXISTS customers_basket;
    CREATE TABLE customers_basket (
      customers_basket_id int(11) NOT NULL auto_increment,
      customers_id int(11) NOT NULL default '0',
      products_id tinytext NOT NULL,
      customers_basket_quantity float NOT NULL default '0',
      final_price decimal(15,4) NOT NULL default '0.0000',
      customers_basket_date_added varchar(8) default NULL,
      PRIMARY KEY  (customers_basket_id),
      KEY idx_customers_id_zen (customers_id)
    ) TYPE=MyISAM;
    
    DROP TABLE IF EXISTS customers_basket_attributes;
    CREATE TABLE customers_basket_attributes (
      customers_basket_attributes_id int(11) NOT NULL auto_increment,
      customers_id int(11) NOT NULL default '0',
      products_id tinytext NOT NULL,
      products_options_id varchar(64) NOT NULL default '0',
      products_options_value_id int(11) NOT NULL default '0',
      products_options_value_text BLOB NULL,
      products_options_sort_order text NOT NULL,
      PRIMARY KEY  (customers_basket_attributes_id),
      KEY idx_cust_id_prod_id_zen (customers_id,products_id(36))
    ) TYPE=MyISAM;
    .

    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.

 

 

Similar Threads

  1. 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
  2. 1062 Duplicate entry '0' for key 1
    By FredZ in forum General Questions
    Replies: 4
    Last Post: 3 May 2010, 02:32 AM
  3. 1062 Duplicate entry '' for key 2
    By Shavelieva in forum General Questions
    Replies: 0
    Last Post: 17 Nov 2007, 06:07 AM
  4. 1062 Duplicate entry '0' for key 1
    By knitengale in forum General Questions
    Replies: 8
    Last Post: 12 Jul 2006, 12:50 AM

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