Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

What means Error 1062 Duplicate entry '0' for key 1 ?


capsulas

Recommended Posts

Posted

I really appreciate your help, with the following error in my database :?:

 

MYSQL QUERY ERROR REPORT

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

1062 - Error 1062 Duplicate entry '0' for key 1

Posted

I really appreciate any advice, with the following error in my database :?:

 

MYSQL QUERY ERROR REPORT

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

1062 - Error 1062 Duplicate entry '0' for key 1

 

Thanks for your help !

Posted

I added the contribution ramdom_order_number

 

1. I modified orders_id type from INT(11) to VARCHAR(11) in the following tables, and turn Auto_increment OFF in orders table.

 

orders

orders_products

orders_products_attributes

orders_products_download

orders_status_history

orders_total

 

2. I modified the following code:

 

$sql_data_array = array('customers_id' => $customer_id, to the following code:

$sql_data_array = array('orders_id' => $ordernum,

'customers_id' => $customer_id,

 

3. Change this Code:

$insert_id = tep_db_insert_id(); to the following code:

$insert_id = $ordernum;

  • 2 weeks later...
Posted

I also have the random order number contriubution installed, BUT I have had it installed for WEEKS, and the 1062 error only started today. I have not added any new contributions (let me think...). This occurs when I try to create and account or checkout without an account (installed contribution). I was just testing those features yesterday and nothing was wrong. This is really odd/frustrating. Any hints would be greatly appreciated!

Posted

The 1062 error was REALLY puzzling because it was the customer_id, which I have set to auto_increment. And, like I said, I HADN'T made any changes to the CART... BUT... I did empty my customer table, as I had been testing and making a LOT of bogus accounts. So... I went back to the customers table (even though it had been emptied, customer numbers persisted in customer_baskets) and set the last customer number at 100 (high above anywhere I had yet been), and went mack to my cart to try it out. Ta-da! No error.

 

Basically, what I had figured out was that it was a problem with the database, NOT the cart. And I was able to find out WHERE in the database. So, if you have done something similar to me (emptied a table), look for the field getting the 1062 error in OTHER tables to see if some data is persisting.

 

I've created a couple of new accounts and checked out without an account now, and the problem is GONE!

  • 4 weeks later...
Posted

I made all of this but I have the same problem plus the followin message

 

Warning: Variable passed to reset() is not an array or object in /home/capsulas/capsulasdeconocimiento-www/admin/includes/classes/object_info.php on line 17

 

Warning: Variable passed to each() is not an array or object in /home/capsulas/capsulasdeconocimiento-www/admin/includes/classes/object_info.php on line 18

 

The objet_info.php es:

*/



 class objectInfo {



// class constructor

   function objectInfo($object_array) {

     reset($object_array);

     while (list($key, $value) = each($object_array)) {

       $this->$key = tep_db_prepare_input($value);

     }

   }

 }

?>

 

I really appreaciate your advise... thanks !!!

  • 4 years later...
Posted

I see that you have a very good grasp on the OSCommerce issue mentioned above. I'm having a similar problem, and I was hoping you could help me or teach me so I know what I'm doing wrong. I recently purchased a template, but of course the company won't help me unless I let them host my site. Here's the message I receive:

 

1062 - Duplicate entry '0' for key 1

 

insert into products_options_values_to_products_options (products_options_id, products_options_values_id) values ('1', '5')

 

[TEP STOP]

Posted
I see that you have a very good grasp on the OSCommerce issue mentioned above. I'm having a similar problem, and I was hoping you could help me or teach me so I know what I'm doing wrong. I recently purchased a template, but of course the company won't help me unless I let them host my site. Here's the message I receive:

 

1062 - Duplicate entry '0' for key 1

 

insert into products_options_values_to_products_options (products_options_id, products_options_values_id) values ('1', '5')

 

what this means is that there is already a row in the 'products_options_values_to_products_options' table with a products_options_id of '1'. this is likely a primary key in that table, therefore mysql will not allow duplicate values for that column.

 

if this is happening as a result of the template, then it's going to be really really tough to figure it out. i don't know the template and i don't have the source code.

 

so there's the *why* for your error. unfortunately, i don't have enough to tell you the *what* and help you fix it.

Archived

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

×
×
  • Create New...