问题描述
当我尝试将下面的内容插入我的MySQL时
When I try to insert the below into my MySQL
INSERT INTO `rooms` (`id`, `ip`) VALUES ('131213', '-259857341');
我因以下错误而失败:
Warning: #1264 Out of range value for column 'ip' at row 1
我环顾四周但还没找到如何解决或解决问题......
I am looking around but haven't found how to fix or work it out...
我的字段是无符号整数对于那个条目应该可以正常工作。
My field is unsigned int which should work just fine for that entry.
有什么问题,如何解决?
我使用unsigned int因为我想使用inet_ntoa / aton存储ips。
I am using unsigned int because I wanted to store ips using inet_ntoa/aton.
编辑:
我在MySQL网站上推荐使用unsigned INT:
I am using unsigned INT as recommend in MySQL website:
推荐答案
无符号整数至少表示非负值。
Unsigned integer means non-negative value at least.
不确定这是否是您所需要的,但您可以尝试将有符号整数转换为4字节无符号整数,如ipconverter所做的那样():
Not sure if this is what you need but you can try to convert signed integer to 4 bytes unsigned integer as your ipconverter does (http://www.silisoftware.com/tools/ipconverter.php):
INSERT INTO `rooms` (`id`, `ip`) VALUES ('131213', '-259857341' & 0xffffffff);
这篇关于#1264超出范围值修复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!