PHP inet_aton to store IP address in MySQL Database
Don’t store IP addresses in a database as a string like (192.168.10.10). That is just the human readable form of that number. You want to store it in the database as an integer.
MySQL has built in functions to handle converting a dot-notation ip address to an integer equivalent.
` mysql> SELECT INET_ATON(‘192.168.0.10’) AS ipn; +————+ | ipn | +————+ | 3232235530 | +————+
mysql> SELECT INET_NTOA(3232235530) AS ipa; +————–+ | ipa | +————–+ | 192.