Entering other web address data into mysql

Hello Forum,

I’m looking for suggestions in regards to storing other web addresses in mysql, to be pulled up later using PHP. I already have my column created as a varchar(255).

For example, would it be best to store Site Point as “sitepoint.com” or “http://sitepoint.com”. If I go with just “sitepoint.com” I can have PHP add the http:// to the beginning of it later in my webpage. I guess if the site is secure, it would be redirected… but if it is something other than http:// or https:// than I guess I could be in trouble.

I just want to know if there is a Best Practice for storing web addresses? Or what you found to work the best, etc…

Thank you for taking the time to read my post and any suggestions would be greatly appreciated. --Ben

It kind of depends on what you are going to use the column for. If it is only ever going to store an http URL, then you may as well store the “http://” portion in there with the site address.

If, on the other hand, you are planning on storing any type of URI (such that some rows will be http addresses and some other rows will be ftp addresses and still others will be mailto addresses), then I wouldn’t store the scheme name in the same column. Instead I would create a second column that would specify the scheme name.