Re: MySQl IP Address Storage

From: Date: Thu, 20 Sep 2001 18:59:36 +0000
Subject: Re: MySQl IP Address Storage
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-68031@lists.php.net to get a copy of this message
Thank you very much. Felix ----- Original Message ----- From: "Jason Bell" <jbell@barkingrat.com> To: "PHP list" <php-general@lists.php.net> Sent: Thursday, September 20, 2001 12:49 PM Subject: Re: [PHP] MySQl IP Address Storage > Felix, > > Just to save you the headache that I encountered, the column that you plan > to store your IP address in needs to be an unsigned integer when using > INET_ATON and INET_NTOA > > If it's not, all addresses stored will come out as 127.0.0.0 (I think that > was what it was...). > > Also, these are MySQL functions, not PHP functions. Not sure if you knew > that already, but it wasn't specified on the list... > > > INET_ATON converts from Decimal IP and INET_NTOA converts back to Decimal > IP, so you'd use it like this: > > INSERT INTO mytable (ipaddress) VALUES (INET_ATON('192.168.1.1')); > > SELECT INET_NTOA(ipaddress) FROM mytable; > > Make sense? > > ----- Original Message ----- > From: "Felix" <felix@blue-stream.com> > To: "Robert Covell" <rcovell@rolet.com>; "PHP list" > <php-general@lists.php.net> > Sent: Thursday, September 20, 2001 11:29 AM > Subject: Re: [PHP] MySQl IP Address Storage > > > > Thank you Robert. > > Felix > > ----- Original Message ----- > > From: "Robert Covell" <rcovell@rolet.com> > > To: "Felix" <felix@blue-stream.com>; "PHP list" > <php-general@lists.php.net> > > Sent: Thursday, September 20, 2001 10:55 AM > > Subject: RE: [PHP] MySQl IP Address Storage > > > > > > > INET_ATON > > > > > > and > > > > > > INET_NTOA > > > > > > -----Original Message----- > > > From: Felix [mailto:felix@blue-stream.com] > > > Sent: Thursday, September 20, 2001 11:49 AM > > > To: PHP list > > > Subject: [PHP] MySQl IP Address Storage > > > > > > > > > Hello all > > > > > > Can anyone suggest their best idea for a way to store IP addresses in a > > > MySQL Database? > > > > > > Felix > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > > For additional commands, e-mail: php-general-help@lists.php.net > > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > > For additional commands, e-mail: php-general-help@lists.php.net > > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#68031) next »