Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Error 1062 - create_account_process


jcroson

Recommended Posts

I am having fits figuring this one out, and would be WAY grateful if anyone has a solution.

 

Conditions using 2.2-MS1

1. My customers table is empty.

2. I enter a test customer successfully.

3. Whenever I try to enter another customer, I get this error:

 

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 ('25', '1', 'Test', 'Testing', '8484 blabla', '12345', 'Nowhere', '223', 'm', '', '', '64', '')

 

[TEP STOP]

 

I currently have one customer registered, and it is clear that this one fails because of the entry number wanting to be "1". The code for this is in the aforementioned file create_account_process.php:

 

    $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);

 

I suppose I'll try and change the address_id in the address_book table to NOT auto-increment...we'll see.

 

JC

John Croson

Technology Operations Manager

Racine Art Museum

Link to comment
Share on other sites

If you are using MS1 and not using autoincrement on the field, you need to delete the field ... remake the field by adding to the beginning of the table.

 

Just changing it is not enough.

 

The question is ... in MS1 it is not autoincrement. In MS2 it is.

 

How did your's get to be autoincrement in the first place?

 

Check your customers table and address book relationship. You need to have your customers set to the right address_id

Link to comment
Share on other sites

Thanks for your reply, but that didn't work. I have no idea how the address_book_id field got to be auto-increment...wait, I installed a CVS version first time 'round, and rolled back to MS1.

 

But even with the mods I installed, etc. I was able to add more than one customer. None of the mods I use effected the address_book table at all.

 

This is driving me nuts, because I've got a full cart designed and ready to roll...

 

Here is a dump:

 

mysql>SHOW TABLE CREATE address_book;

| address_book | CREATE TABLE `address_book` (

`customers_id` int(11) NOT NULL default '0',

`entry_gender` char(1) NOT NULL default '',

`entry_company` varchar(32) default NULL,

`entry_firstname` varchar(32) NOT NULL default '',

`entry_lastname` varchar(32) NOT NULL default '',

`entry_street_address` varchar(64) NOT NULL default '',

`entry_suburb` varchar(32) default NULL,

`entry_postcode` varchar(10) NOT NULL default '',

`entry_city` varchar(32) NOT NULL default '',

`entry_state` varchar(32) default NULL,

`entry_country_id` int(11) NOT NULL default '0',

`entry_zone_id` int(11) NOT NULL default '0',

`address_book_id` int(11) NOT NULL default '0',

PRIMARY KEY (`address_book_id`),

KEY `idx_address_book_customers_id` (`customers_id`)

) TYPE=MyISAM |

 

JC = LOST~ :cry:

John Croson

Technology Operations Manager

Racine Art Museum

Link to comment
Share on other sites

That did it! I took 2.2-MS1 and clipped the sql statement reguarding the address_book table. It seems that in MS1 the default structure of the table was this:

 

| address_book | CREATE TABLE `address_book` (

`customers_id` int(11) NOT NULL default '0',

`address_book_id` int(11) NOT NULL default '1',

`entry_gender` char(1) NOT NULL default '',

`entry_company` varchar(32) default NULL,

`entry_firstname` varchar(32) NOT NULL default '',

`entry_lastname` varchar(32) NOT NULL default '',

`entry_street_address` varchar(64) NOT NULL default '',

`entry_suburb` varchar(32) default NULL,

`entry_postcode` varchar(10) NOT NULL default '',

`entry_city` varchar(32) NOT NULL default '',

`entry_state` varchar(32) default NULL,

`entry_country_id` int(11) NOT NULL default '0',

`entry_zone_id` int(11) NOT NULL default '0',

PRIMARY KEY (`address_book_id`,`customers_id`)

) TYPE=MyISAM |

 

HUGE difference from what mine was...go figure.

 

Thanks for getting my brain in gear!

 

JC

John Croson

Technology Operations Manager

Racine Art Museum

Link to comment
Share on other sites

That the address book was messed up on the order and needed to be reloaded, changed what have you.

 

I crossed an MS1 and MS2 version myself and tried to go back to MS1 ... I lived to tell the story ... 8)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...