Location: PHPKode > scripts > Storeip > storeip/php_and_mysql.txt
After posting this class at phpclasses.org

I got serveral emails about mysql default function
to do to same (in a better way (?)) and the same for

For MYSQL>=2.23:

Use field properties for IPs
ip int unsigned NOT NULL default '0'

Use MySQL functions- from int to ip, and from ip to int

INET_NTOA(expr) Given a numeric network address (4 or 8 byte), returns the dotted-quad representation of the address as a string:
mysql> SELECT INET_NTOA(3520061480);
->  ""
INET_ATON(expr) Given the dotted-quad representation of a network address as a string, returns an integer that represents the numeric
value of the address. Addresses may be 4 or 8 byte addresses:
mysql> SELECT INET_ATON("");
->  3520061480
The generated number is always in network byte order; for example the above number is calculated as 209*256^3 + 207*256^2 + 224*256 +40.

see: http://www.mysql.com/doc/en/Miscellaneous_functions.html

Thanks to:
AzDG <hide@address.com>
Michael Brunson <hide@address.com>
FOR PHP>=4.0
You shouldn't even use this class!!
Use ip2long() and long2ip() insteads

Note:  Because PHP's integer type is signed, and many IP addresses will result in negative integers, you need to use the "%u" formatter of sprintf() or printf() to get the string representation of the unsigned IP address.

Thanks to:
Alexei Saveliev <hide@address.com>
Return current item: Storeip