Displaying Database Value as Hyperlink

Hello! I cannot figure this out. I would like to display a MySQL database value as a hyperlink.

For example, the PHP displays the following:

Name: Mary
ID: 1
Profile: http://profilelink.com

I want the PHP to display that data as is, except that the http://profilelink.com is displayed as a clickable link.

I hope this makes sense. Here is the code I have now:
[php]Add entry


<?php /// In order to use this script freely /// you must leave the following copyright /// information in this file: /// Copyright 2012 www.turningturnip.co.uk /// All rights reserved. include("connect.php"); $result = mysql_query("SELECT * FROM characters "); $num = mysql_num_rows ($result); if ($num > 0 ) { $i=0; while ($i < $num) { $id = stripslashes(mysql_result($result,$i,"id")); $name = stripslashes(mysql_result($result,$i,"name")); $breed = stripslashes(mysql_result($result,$i,"breed")); $gender = stripslashes(mysql_result($result,$i,"gender")); $color = stripslashes(mysql_result($result,$i,"color")); $markings = stripslashes(mysql_result($result,$i,"markings")); $genetics = stripslashes(mysql_result($result,$i,"genetics")); $player = stripslashes(mysql_result($result,$i,"player")); $traits = stripslashes(mysql_result($result,$i,"traits")); $defects = stripslashes(mysql_result($result,$i,"defects")); $profile = stripslashes(mysql_result($result,$i,"profile")); $row .= ' Name: '.$name.'
ID: '.$id.'
Breed: '.$breed.'
Gender: '.$gender.'
Color: '.$color.'
Markings: '.$markings.'
Genetics: '.$genetics.'
Traits: '.$traits.'
Defects: '.$defects.'
Profile: '.$profile.'
Player: '.$player.'

'; ++$i; }} else { $row = 'Nothing found'; } mysql_close(); ?> <? echo $row ?>
[/php]

Any help is GREATLY appreciated! Thank you!

The way I do this is to store just the url without the http:// in a database field.

When I come to display it in an html page I add the http:// back to the retrieved database string and then just display it in normal a tags.

Sponsor our Newsletter | Privacy Policy | Terms of Service