Forum Moderators: coopster
$result = mysql_query("SELECT DATE_FORMAT(date, '%d %M %Y')",$db);
Is there a way to also format a URL, as I have in my db a field called PartyURL where I have stored the website. eg: www.domainname.com
When retrieving the data I want to have it formatted like [domainname.com...] and of course it should be a hyperlink.
Or do I have to format it why displaying it in a table?
Thanks in advance.
I would.
Leave the database to do what it does best - storing stuff. Your presentation of that data is best done away from the database.
Be aware that if you are storing a URL without the protocol component (i.e. [)...] then you will not be able to store URLs to secure sites (unless the site in question redirects automatically). I would store the protocol in the database also.
If you have end users inputting a URL into a form; it is easy to look at the input and see if they have entered "http" at the start. If they have not then you can assume a plain HTTP site and add "http://" to the start of the URL. This will allow people to add secure sites if they wish...