Error: Duplicate entry '255' for key 1
| User, date | Message |
|---|---|
|
Written by gilgal
5 years ago Category: General 32 posts since Wed, 12 Dec 07 |
I'm getting this error when I insert into the database table and ends inserting at id 255. wrote: Error: Duplicate entry '255' for key 1 |
|
Written by ansgar
5 years ago 3952 posts since Fri, 07 Apr 06 |
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. |
|
Written by gilgal
5 years ago 32 posts since Wed, 12 Dec 07 |
ok thanks. I'm not that familiar with the datatypes. Should the default be set to 1 or 0? |
|
Written by ansgar
5 years ago 3952 posts since Fri, 07 Apr 06 |
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. |