I'm having bit of a trouble selecting correct values from my mysql sql server.
The ip can be ipv6 and v4.
Table: User{
...
ip binary(16)
}
$ip = '192.168.10.115';
$ip = bin2hex(inet_pton($ip)); // Returns c0a80a73
$result = $this->db->select("SELECT * FROM User WHERE HEX(ip) = $ip");
// $result empty because in db its stored as:
// HEX(ip) = C0A80A73000000000000000000000000
How can I get a viable match to the * 00000 * ?
If input was a ipv6 match this would be ok, but ip v4 not.