Guest Posted December 2, 2003 Share Posted December 2, 2003 I am getting the following error message when I sign up as an already existing customer ie email, can anyone help? 1062 - Duplicate entry '1' for key 1 insert into address_book (customers_id, address_book_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 ('2', '1', 'Samuel', 'Johnstone', '2 10-16', '2103', 'MONA VALE', '13', 'm', '', '', '0', 'NSW') [TEP STOP] Regards Sam Link to comment Share on other sites More sharing options...
mj999 Posted December 17, 2003 Share Posted December 17, 2003 Did you figure anything out. I'm having the same problem. Link to comment Share on other sites More sharing options...
goXtreme Posted December 18, 2003 Share Posted December 18, 2003 I was getting this error message when I created a new customer account. I'm pretty new to php and osCommerce is installed by my host as part of the package, so reinstalling is not ideal. Using version 2.2 MS1 I noticed that the error coincides with the address_book_id. In every other database (except Oracle) I've ever used, there is no need to include the ID field it is an autoincremented field. I went into the create_account_process.php file and updated the array to remove the address_book_id value (below), which seems to effect the insert. [line 266 - the header on the file shows: $Id: create_account_process.php,v 1.2 2003/06/19 11:43:15 mdima Exp $] /* $sql_data_array = array('customers_id' => $customer_id, 'address_book_id' => 1, 'entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_country_id' => $country); */ $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); This seemed to solve my problem regarding the insert into the address book, but when I go back to "My Account", all the data is empty. If I click on the Edit Account button, the form is empty. If I click on the "Address Book" button, then select my name, then it opens up the data entered when I signed up originally. The further I get into a problem, the more problems seem to arise after it is resolved. Perhaps it would be better to have my host recreate the installation template they use or I'll download the "latest & greatest" and give that a try. I'm already in the red on this project, now I'm just trying to save face. Any suggestions would be appreciated! Link to comment Share on other sites More sharing options...
logiczero Posted December 19, 2003 Share Posted December 19, 2003 I'm having this problem too... I'm using MS2, and create_account_process.php doesn't exist. I think create_account.php now handles those duties... I did a search for "$sql_data_array = array('customers_id'", and everywhere it appears looks like goXtreme's code change, so maybe it's something that got updated in MS2. I have a pretty limited understanding of mySQL, so it would be great if someone could explain why there are two primary keys on that table: customers_id and address_book_id. Wouldn't just address_book_id be sufficient? By making customers_id a primary key, doesn't that mean it can't have duplicate values? And if that's the case, how are you supposed to assign more than one address to one customer? Link to comment Share on other sites More sharing options...
logiczero Posted December 19, 2003 Share Posted December 19, 2003 Well, I answered my own question by looking in oscommerce.sql in the install directory. The address_book table SHOULD only have one primary key: address_book_id. So when I was trying to assign a new address to an existing customer, it complained about already having a value for that key. Some how my address_book table got messed up in the upgrade process...now the data in it is out of whack. Fortunately, I can empty it and start over. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.