當我嘗試插入下面的進入我的MySQL#1264超出範圍值修復?
INSERT INTO `rooms` (`id`, `ip`) VALUES ('131213', '-259857341');
我失敗,與後續的錯誤:
Warning: #1264 Out of range value for column 'ip' at row 1
我環顧四周,但還沒有找到如何解決或解決它。 ..
我的字段是無符號int這應該工作得很好,爲該條目。
什麼問題,我該如何解決?
我使用unsigned int因爲我想用inet_ntoa/aton來存儲ips。
編輯:
我使用unsigned int類型的建議在MySQL網站:
To store values generated by INET_ATON(), use an INT UNSIGNED column rather than INT, which is signed. If you use a signed column, values corresponding to IP addresses for which the first octet is greater than 127 cannot be stored correctly. See Section 10.6, 「Out-of-Range and Overflow Handling」.
http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html
什麼是類型提交ip? – JellyBelly
它是在上面的問題;)'我的領域是無符號整數,應該適用於該條目.'因爲-259857341不超過最小值和最大值。 – Guapo
int字段有多少個字節?參考:http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html – JellyBelly