zurv Posted April 6, 2005 Posted April 6, 2005 When I try to create an account I keep getting this error. 1062 - Duplicate entry '12' for key 1 insert into customers_info (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('12', '0', now()) [TEP STOP] Any ideas?
Guest Posted April 6, 2005 Posted April 6, 2005 Can you execute the following code against the database via phpMyAdmin and tell me the result? SELECT MAX(customers_info_id) from customers_info
zurv Posted April 6, 2005 Author Posted April 6, 2005 I get the following: SQL-query: SELECT MAX( customers_info_id ) FROM customers_info MAX(customers_info_id) 12 .....
Guest Posted April 6, 2005 Posted April 6, 2005 1. Backup your database. 2. If the result is 12 then use 13 in the following SQL, e.g. ALTER TABLE `orders` AUTO_INCREMENT = 13;
zurv Posted April 7, 2005 Author Posted April 7, 2005 It executes fine but dosent solve the problem or change the error. It seem to create the customer in the SQL but with no information.
Guest Posted April 7, 2005 Posted April 7, 2005 Your database might be corrupted. It could be the result of a contribution or a number of things such as manual database editing. 1062 - Duplicate entry '12' for key 1 Means that you are trying to asign a value of 12 in your primary key where 12 has already been use in a previous customer's record and therefore, not unique. P.S. Changing auto index does not create an empty account. It allows you to specify the next primary key value of a table.
zurv Posted April 7, 2005 Author Posted April 7, 2005 What I meant was.. Even though it gives me an error, the account is created but some data is missing. How can I resolve my problem? Is there anyway I can wipe the customers and reset it?
zurv Posted April 7, 2005 Author Posted April 7, 2005 I FIXED IT!! There have been a lot of people with this problem and it all comes down to Contributions that are not clear, and end up being incompatibale with others. I have a "how did you hear about us" contrib that caused my error. The contribution did not state to "replace" the code but instead to "add" it leaving the original code there which tried to add the member twice. More info on it herE: http://www.oscommerce.com/forums/lofiversion/i.../t96806-50.html The part that helped me follows: ======================== Well I did some checking. I found my error. Actually this works with all the contributions listed above. It's just maybe I didn't understand the instructions to clearly. All of the changes are additions except one part which is not really an addition but total change. In /catalog/create_account.php ** tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'"); //rmh referral start tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created, customers_info_source_id) values ('" . (int)$customer_id . "', '0', now(), '". (int)$source . "')"); if ($source == '9999') { tep_db_perform(TABLE_SOURCES_OTHER, array('customers_id' => (int)$customer_id, 'sources_other_name' => tep_db_input($source_other))); } //rmh referral end ** if (SESSION_RECREATE == 'True') { The //rmh referral start/end should replace any stock OEM code ** & ** which are the stock OEM code. I just actually added to the code which is why I was getting this error and this may be why others got the same error. There are no instructions on adding or replacing, you have to search for the changes made in the diff files provided by the author. Anyways, I looked into the db beforehand and could not find any of my contribs conflicting with the *.sql update provided with this contrib so it had to be something on my part. I guess my impatience waiting for an answer actually paid off and it'll now make me more proactive in searching for my own answers rather than ask and expect and answer. --------------------------------- Thank you for helping man
Recommended Posts
Archived
This topic is now archived and is closed to further replies.