# PHP/MySQL Duplicate entry '0' for key 1

**URL:** <https://forum.kirupa.com/t/php-mysql-duplicate-entry-0-for-key-1/206353>\
**Category:** programming\
**Created:** [November 7, 2006, 2:07pm UTC](https://forum.kirupa.com/t/php-mysql-duplicate-entry-0-for-key-1/206353 "2006-11-07T14:07:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neolumi](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/neolumi/32/1306_2.png) [@Neolumi](https://forum.kirupa.com/u/Neolumi)\
**Post date:** [November 7, 2006, 2:07pm UTC](https://forum.kirupa.com/t/php-mysql-duplicate-entry-0-for-key-1/206353/1 "2006-11-07T14:07:18Z")

</div>

hey people, I’m at wits end with this sql stuff. I’m trying to write a script for editing a products information. Though I keep getting errors with the sql, on odd moments it actually screws up the table itself and then I have to do, table repair table\_name;. The standard error I get is

“Duplicate entry ‘0’ for key 1”

heres the sql:

```auto
UPDATE tcom_products SET
product_id='NULL', product_pic='NULL', product_title='Toy5',
product_category='1', product_brand='2', product_price='4.00',
product_was='0.00', product_stock='10', product_code='', product_age='2',
product_desc='Blah sdsdasdsa', product_active='0'
WHERE product_id='18' AND product_code='10'

```

table structure:

Field Type Attributes Null Default Extra  
product\_id tinyint(4) No auto\_increment  
product\_title varchar(250) Yes _NULL_  
product\_category tinyint(3) Yes _NULL_  
product\_shipping tinyint(2) Yes _NULL_  
product\_brand tinyint(3) Yes _NULL_  
product\_price varchar(5) Yes _NULL_  
product\_was varchar(5) Yes _NULL_  
product\_stock tinyint(4) Yes _NULL_  
product\_code varchar(8) Yes _NULL_  
product\_age tinyint(2) Yes _NULL_  
product\_pic varchar(250) Yes _NULL_  
product\_desc text Yes _NULL_  
product\_active tinyint(1) Yes _NULL_

Indexes:  
Keyname Type Cardinality Field  
PRIMARY PRIMARY 8 product\_id  
product\_code UNIQUE 8 product\_code  
product\_title FULLTEXT 8 product\_title  
product\_desc FULLTEXT 8 product\_desc 1

As its only the sql thats going nuts I’ll leave out the php file, but will post if needed.
