Hello I want to save ip_addresses into my mysql database. It should work for ipv4 and ipv6. I found the solution to use inet_pton from php. However 90% of the entries are fine but 10% fails to convert with inet_nton back to ipv6 or ipv4 (not sure which one)
my database looks like so
ip - varchar(30) - latin1_bin
I just do
$ip_pton = inet_pton($_SERVER["REMOTE_ADDR"]);
if I try to convert back I just use inet_ntop. Like above I said maybe from 100 entries I get just few warnings
Warning: inet_ntop(): Invalid in_addr value
Example converted ip is this "`E" It cannot be converted back. I get the error above.
I did I maybe use wrong data types in mysql?