When I try to insert the below into my MySQL
INSERT INTO `rooms` (`id`, `ip`) VALUES ('131213', '-259857341');
I fails with the follow error:
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.
What is the problem and how do I solve ?
I am using unsigned int because I wanted to store ips using inet_ntoa/aton.
EDIT:
I am using unsigned INT as recommend in MySQL website:
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
My field is unsigned int which should work just fine for that entry.
Since -259857341 does not exceed the minimum nor maximum. – Crumpler-259857341
into your db. The column may be namedIP
but that does make the value anything like an ip-address? – Homerus