From: Date: November 11 2005 9:47pm Subject: Re: Best Fieldtype to store IP address... List-Archive: http://lists.mysql.com/cluster/2783 Message-Id: <4375037F.1010708@ugly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Evan Borgstrom wrote: > The same way the kernel deals with them; int(10) unsigned. To convert a > dotted quad string into int(10) use the following: > > Using 192.168.10.50: > 192 + (168 * 2^8) + (10 * 2^16) + (50 * 2^24) = 839559360 > > This is real handy if you're doing low level socket stuff and storing > addresses in the database. > > -Evan This is how I've stored IP information in the past. It also makes it much easier to sort by IP, etc. However I believe you mean (192 * 2^24) + (168 * 2^16) + (10 * 2^8) + 50 = 3232238130