Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Duplicate entry" problem

Status
Not open for further replies.

george123456724

Technical User
Feb 26, 2002
6
GB
Hi guys,

Have created a database using the MySQL control panel and phpMyAdmin. Nothing fancy, I'm just using it like an online Excel spreadsheet that can be updated by multiple users.

Everything was going great until this afternoon. I tried to add a new entry to the table, and I got the error:

"Duplicate entry '127' for key 1"

I kind of understand this - the entry would have been #127.

Each entry is assigned an auto-increment number which I use as a reference code. This field is the table's primary key.

Does anyone know why I am being prevented from adding entry #127?

I get the same problem both in mySQL Administrator and phpMyAdmin.

Thanks,

GeorgeC
 
being #127, my guess is that your auto_increment field might be of type tinyint signed. If this is the case, any number over 127 is treated as 127, so you can't add anymore.
 
Thanks very much Hung-Hsun Su - you're right.

It's working fine now.

Just out of interest, do you know what the maximum values are for smallint, mediumint, int and bigint?
 
tinyint - 8 bits (-128 to 127 ro 0 to 255 depending on signed/unsigned)
smallint - 16 bits
mediumint - 24 bits
int - 32 bits
bigint - 64 bits
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top