PHP & MySQL help. Stored IPs as decimals?

Jason

New member
I need help building a search function on stored IPs that are stored by MySQL using INET_ATON() and INET_NTOA(). So the IPs are stored as IP long decimal, and shown as the 4 quadrant or xxx.xxx.xxx.xxx. Im building a search function and i ran into a problem. Searching for "68" or "68." or any other partial IP format that is searched via MySQL "LIKE %string%"; doesn't return any results and that is because those are not valid 4 quadrant IPs so they don't get converted right.

How can i solve this and be able to search a database of IPs that are stored as long decimal but still use INET_ATON() and INET_NTOA().

Thanks!
 
Back
Top