my ip field in the mysql database is VARBINARY(16)
// Insert into website table
$ip = inet_pton('::1'); // Local ip
$data_rec = array(
'ip_address' => $ip,
);
$this->db->insert('visitors', $data_rec);
The ip doesn’t get inserted. It’s a blank field. Why is that?
inet_pton()returns unprintable characters.Did you try to read it from the database and do
echo inet_topn()?Given that I have a table
And using this simple script (all checks intentionally omitted for simplicity)
you get the output
But you can’t see the value in phpAdmin or Sequel Pro