Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

1062 - Duplicate entry '1-216' for key 1


Brizo

Recommended Posts

Any advice would be much appreciated. A customer reported that they were getting an error (see below) when they tried to purchase from my store. I was able to duplicate their error and I think I've figured out what's happening - I'm just not sure how to solve it.

 

When a new customer comes to the site to setup an account, they enter their address. For some reason this address isn't being saved as their Primary Address and therefore when they go to purchase something it shows their Primary Address as a comma "," The customer then tries to enter their address into the shipping address page during the checkout process. When they go to submit their shipping address, its already saved in the database so the following error is returned.

 

I've figured out two workarounds and neither are practical:

1. The customer is smart enough to log into their newly created account, find their address and make it their primary address

or

2. The customer enters a different shipping address in the checkout process than they did when their created their account.

Please help - I can't get orders from any new customers until this is solved. The error is as follows:

1062 - Duplicate entry '1-216' for key 1

 

insert into address_book (customers_id, entry_firstname, entry_lastname, entry_street_address, entry_postcode, entry_city, entry_country_id, entry_gender, entry_company, entry_suburb, entry_zone_id, entry_state) values ('216', 'Kristi', 'Stephens', '5555 5th Ave', '37918', 'knoxville', '223', 'f', '', '', '56', '')

 

[TEP STOP]

Link to comment
Share on other sites

1062 - Duplicate entry '1-216' for key 1

 

insert into address_book (customers_id, entry_firstname, entry_lastname, entry_street_address, entry_postcode, entry_city, entry_country_id, entry_gender, entry_company, entry_suburb, entry_zone_id, entry_state) values ('216', 'Kristi', 'Stephens', '5555 5th Ave', '37918', 'knoxville', '223', 'f', '', '', '56', '')

 

[TEP STOP]

Looks like the address_book_id in the table address_book is no longer an auto-increment field? Can you check the database for that?

Link to comment
Share on other sites

Looks like the address_book_id in the table address_book is no longer an auto-increment field? Can you check the database for that?

 

Thanks for the input. I just checked and the field was not set to Auto-Increment. So, by changing that to Auto-Increment, won't it just allow users to enter the same address twice?

 

What I'm trying to do is make it so this problem doesn't even come up by making sure that when a new account is setup it automatically saves the address entered by the user as the Primary Address. Will the auto-increment solve that problem?

 

Sorry, I'm a total novice fumbling my way through this.

 

Thanks again for your help!

Link to comment
Share on other sites

Looks like the address_book_id in the table address_book is no longer an auto-increment field? Can you check the database for that?

 

 

Actually, just tested it and it works! You were exactly right - thank you very very much for your help!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...