I read that the best way to store IP addresses in a database is to make an Unsigned Int(10) field. How do I convert the IP addresses using PHP? I've tried using
$this->ip = long2ip($_SERVER['REMOTE_ADDR']);
But this doesn't seem to work. I found the way to convert it back to an IP address using
$this->ip = sprintf("%u", ip2long($result['ip']));
How do I convert the IP Address initially? Should I be using PHP for this? Or would it be better to integrate into the MySQL query?