05.11.2015, 15:14
Since you explicitly mention IPs, consider saving them in integer format because this gives you additional possibilities to search. You can do:
Which would be shear impossible to accomplish with LIKE. See my tutorial for a more elaborate explanation.
PHP Code:
... WHERE ip BETWEEN INET_ATON('172.16.0.0') AND INET_ATON('172.31.255.255');