From: "Scott Haneda" <[EMAIL PROTECTED]>
> Any idea what I should convert a IP address into in order to be able to
> operate on it with simple greater than, less than and equal to math?

As a compromise between human readability and searchability you could store
the IP-address as a series of zero-padded numbers in a VARCHAR field:
012.008.197.010 -> 012.008.197.100

Now you can use string comparison operators such as >, <, =, BETWEEN and
even LIKE to see if the IP-address is in the range 12.8.* (from_ip LIKE
'012.008.%').
If you want to use normal IP-masks than you probably want to use unsigned
integer using the inet_aton and inet_ntoa functions as suggested by others.

Regards, Jigal.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to