distal-attribute
distal-attribute
distal-attribute
distal-attribute

Error: Duplicate entry '255' for key 1

gilgal posted 10 years ago in General
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 posted 10 years ago
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.
gilgal posted 10 years ago
ok thanks. I'm not that familiar with the datatypes. Should the default be set to 1 or 0?
ansgar posted 10 years ago
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.