当我尝试插入下面的进入我的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