MySQL function INET_ATON()

MySQL Function INET_ATON()

MySQL function INET_ATON(‘ip_address’)

Converting IP Address to Big Integer.

One sample of use:

Find out does user “faras1” logged in within 192.168.1.111 – 192.168.1.124 on local network?

SELECT id, user_id, user_name, user_ip, message, `action`, created_at, updated_at FROM logs WHERE INET_ATON(user_ip) BETWEEN INET_ATON('192.168.1.111') AND INET_ATON('192.168.1.124') AND user_name='faras1';

Result:

MySQL function INET_ATON()

Share this:

Leave A Comment?