decimal ip converter
Why this script
On the internet one can find databases of ip-ranges and their country of origin. An example is:
http://ip-to-country.webhosting.info/
These ranges however, are always in decimal form. And although it would be way faster to save your visitors ip in decimal form, instead of converting it on the spot when doing a lookup, this function might still be handy for short term purposes, or to use in an UPDATE on your table.
Usage
Simply copy-paste the example and replace ip & visitors with the right names
Or, when you use the stored function, simply create it and use it like you would use a native mysql function.
Changelog
2.6 (2010-11-10)
- Added a stored function which can perform the same trick