Encoding string for use in sorting and query
Date: 20 Jul 2001 10:34:26 -0700
Message-ID: <3c17183c.0107200934.62f63e51_at_posting.google.com>
I am trying to create a database in mySQL to track usage of IP addresses. However, not being an ace database type, I am stumped as to how to encode a string such that I can sort addresses and query accurately for a range. If I have the IP address in dotted decimal notation represented as a string, does anybody know of a way to easily encode that data for storage in another field? The kicker is I also need to be able to decode that string back into a dotted decimal notation IP address. PHP has a simple function called ip2long() and the opposing long2ip() that do the trick, but I don't necessarily want to do all the encoding/decoding within a php script. Any help would be fantastic.
Thanks,
Joe Received on Fri Jul 20 2001 - 19:34:26 CEST