note 58388 deleted from function.ip2long by danbrown
| From: | danbrown@php.net | Date: | Fri, 05 Dec 2008 13:38:32 +0000 |
| Subject: | note 58388 deleted from function.ip2long by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147693@lists.php.net to get a copy of this message | ||
Note Submitter: paul at santasoft point com
----
to complement daevid at daevid dot com's note (11 Nov 2004) about the catch being that PHP
returns negative values....
If you define your mysql column that stores the ip address in INT format as signed (not unsigned),
then it'll work just fine.
No need to do any conversion using sprintf and this way you'll keep the value and be able to
use PHP's long2ip() function on the value and get an accurate result.
SO.. define your MySQL column as signed (leave the Attributes select box in phpMyAdmin blank) and
you won't need to do any conversions or whatnot.