__/ [ William Tasso ] on Friday 17 March 2006 17:49 \__
> Now what do you suppose might be the most appropriate data type for
> storing an IP-Address?
> Thoughts (considered and/or random) most welsome.
IP addresses are essentially bits, but to use some abstracting, go with
numbers. Strings will not allow you to manipulate the data much (unless
converted to numbers, which needs string validation). For example, think of
operations like "find all IP address on the same subnet (e.g. C-block).
Also remember IPv6, so leave enough space for that. Look at existing systems
for inspiration. WordPress is the only one which I am sufficiently familiar
with. I have just run phpMyAdmin. WordPress stores IP addresses as follows:
Field Attributes Null
comment_author_IP varchar(100) No
You are very welsome (sic) *smile*,
Roy S. Schestowitz | "In hell, treason is the work of angels"
http://Schestowitz.com | SuSE Linux ¦ PGP-Key: 0x74572E8E
5:50pm up 9 days 10:27, 7 users, load average: 0.25, 0.36, 0.45
http://iuron.com - Open Source knowledge engine project