Error: Duplicate entry '255' for key 1

[expired user #3277]'s profile image [expired user #3277] posted 16 years ago in General Permalink
I'm getting this error when I insert into the database table and ends inserting at id 255.

Error: Duplicate entry '255' for key 1

ansgar's profile image ansgar posted 16 years ago Permalink
What does 255 say you? The datatype is too small to hold values over that number. I guess the column's datatype is UNSIGNED TINYINT. You should change it to UNSIGNED INT.
[expired user #3277]'s profile image [expired user #3277] posted 16 years ago Permalink
ok thanks. I'm not that familiar with the datatypes. Should the default be set to 1 or 0?
ansgar's profile image ansgar posted 16 years ago Permalink
Usually you take 0, not 1.

But that's unimportant as this default can only get effective one time - then the primary key restricts new data rows from getting this value. A primary key is unique, you have to know.

Please login to leave a reply, or register at first.