Take a look at the MySQL function INET_ATON and it's counterpart (I don't
remember what it's counterpart is but it should be easy to find once you
I know in PHP there is a function that will convert x.x.x.x to an int and
then you just put that int into a field in your database and then use the
INET_ATON function in MySQL to select the ips you want.
SELECT INET_ATON('220.127.116.11') > INET_ATON('18.104.22.168')
That should return TRUE. :)
Hope that helps.
On 3/24/06 2:44 PM, "Lucas Vendramin" <lucas.vendramin@stripped> wrote:
> Hi all.
> I have a problem:
> When I compare two strings in mask (x.x.x.x) the comparation is not true (for
> my question :D)... look:
> select '22.214.171.124' > '126.96.36.199' -> FALSE
> I want this command return TRUE, but it is returning FALSE.
> But, if I put a space first into the smaller string the camparation will
> returns what I want:
> select '188.8.131.52' > ' 184.108.40.206' -> TRUE
> How can I check it? There is a way to correct my problem? The string is like a
> IP-ADDRESS where 192.168.0.13 is better than 192.168.0.2, but it is not a
> IPADDRESS column, it is a Version of file (version 3.2.0, version 3.2.1,
> Thanks for all.