Hi, I am currently working on a banlist and I am thinking about which data type to choose for storing the IP address in the database. Will the Binary data type be ideal?

Recommended Answers

All 4 Replies

Currently I store IP addresses as Varchar.

Binary is meant for binary data such as images, executables, etc. Not text.

Store them as strings. Unless you want to do the string to numeric conversion every time that turns the familiar string representation into its numerical format that's the way to go.

But beware that an ip address isn't the best way to go. Not only is it very easy to get a new one, it's also quite likely that multiple people have the same ip address (for example internet cafes, student dorms, etc.).
MAC address is far better, and if you're having paid accounts, username...

varchar is easier to use, so I will suggest to use it for storing IP address.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.