Hey!
Basically I have a code that allows me to submit an IP address and return information from that IP address.
What I want to do is return all the rows that have the IP range that I submit.
Take this query as an example;
SELECT * FROM ip_address WHERE IP BETWEEN '123.45.0.0' AND '123.45.255.255'
Let's say I submit 192.168.0.1, i'd like to return every IP that has 192.168.0.x
Will the LIKE statement work here - LIKE "%192.123..12%"
No it would not.
https://stackoverflow.com/questions/24179437/mysql-check-if-an-ip-address-is-in-range
Just for the records,
in smf 2.1 the solution would be:
$smcFunc['db_query']('','
SELECT *
FROM ip_address
WHERE ip BETWEEN {inet:start_ip} and {inet:end_ip}',
array(
'start_ip' => '123.45.0.0',
'end_ip' => '123.45.255.255',
)
But works only when you use the inet field type from smf2.1.