Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Duplicate entry - customers_info


dreams3577

Recommended Posts

Posted

Hi All...

 

-----------------------------------------------------------------------

1062 - Duplicate entry '97' for key 1

insert into customers_info (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('97', '0', now())

[TEP STOP]

-----------------------------------------------------------------------

 

I have the above error message when trying to create a new customer account via the signup form of the store, It has been fine up until now with approximatly 400 customers in the store, so I don't know whats gone wrong...

 

From what I have read the only way to clear the error is to trucate the customer, address and order tables.... is that correct or is there a less drastic way to fix it??

 

If trucating the tables is the only way can you please clarify which tables....

 

many thanks

Steve

Posted

-----------------------------------------------------------------------

1062 - Duplicate entry '97' for key 1

insert into customers_info (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('97', '0', now())

[TEP STOP]

-----------------------------------------------------------------------

 

I have the above error message when trying to create a new customer account via the signup form of the store, It has been fine up until now with approximatly 400 customers in the store, so I don't know whats gone wrong...

 

From what I have read the only way to clear the error is to trucate the customer, address and order tables.... is that correct or is there a less drastic way to fix it??

 

If trucating the tables is the only way can you please clarify which tables....

Truncating the tables is emptying them. That is absolutely the last thing you want to do because you destroy data.

 

DId you make any changes to create_account.php. From the code:

 

   $customer_id = tep_db_insert_id();

     $sql_data_array = array('customers_id' => $customer_id,
                             'entry_firstname' => $firstname,
                             'entry_lastname' => $lastname,
                             'entry_street_address' => $street_address,
                             'entry_postcode' => $postcode,
                             'entry_city' => $city,
                             'entry_country_id' => $country);

     if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;
     if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;
     if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;
     if (ACCOUNT_STATE == 'true') {
       if ($zone_id > 0) {
         $sql_data_array['entry_zone_id'] = $zone_id;
         $sql_data_array['entry_state'] = '';
       } else {
         $sql_data_array['entry_zone_id'] = '0';
         $sql_data_array['entry_state'] = $state;
       }
     }

     tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

     $address_id = tep_db_insert_id();

     tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");

     tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");

 

This tells you a number of things. The value 97 is the customer_id in the table customers. If you say you have about 400 customers than something is very wrong here because that number should be above 400 then.

 

Better check your tables customer, address_book, and customers_info (with phpMyAdmin or the like) to see what is going on there. If you have 97 entries in the table customers and 400 in address_book and customers_info then it looks like there has been data destroyed in the past but corresponding data in other tables not removed.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...