The development of the Web site backend system in the test process, this problem occurs:
Invalid query:duplicate entry ' 127′for key 1
SQL is:insert into ' kq_news ' (' Title ', ' Author ', ' Type ', ' Content ', ' Isdel ', ' adate ', ' Range ', ' Lang ') VALUES (' Donation activities ', ' Yuanying ', ' 3′, ', ' 0′,now (), ' 2′, ' CN '
Because it is the first time to encounter such a problem, Google a bit, similar problems n many, solutions have a lot of similarities, nothing more than the repair table (repair), MySQL repair tools Myisamchk tool repair. Tried it, and still did not solve it.
Finally understand that the original ID of this type of self-added field is mistaken! Convert the data type and it's done!
The MySQL manual was then opened and a description of the tinyint and smallint and int types was found:
tinyint[(M)] [UNSIGNED] [Zerofill]
A very small integer. The signed range is 128 to 127, and the unsigned range is 0 to 255.
smallint[(M)] [UNSIGNED] [Zerofill]
A small integer. The signed range is 32768 to 32767, and the unsigned range is 0 to 65535.
mediumint[(M)] [UNSIGNED] [Zerofill]
A medium sized integer. The signed range is 8388608 to 8388607, and the unsigned range is 0 to 16777215.
int[(M)] [UNSIGNED] [Zerofill]
A normal size integer. The signed range is 2147483648 to 2147483647, and the unsigned range is 0 to 4294967295.
integer[(M)] [UNSIGNED] [Zerofill]
This is a synonym for int.
bigint[(M)] [UNSIGNED] [Zerofill]
A large integer. The signed range is 9223372036854775808 to 9223372036854775807, and the unsigned range is 0 to
18446744073709551615.
I see!
That's why other online invalid query:duplicate entry ' 32767′for key 1 went wrong.