Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Php Mysql And How to Save Hyperlinks


8:46 pm on May 21, 2004 (gmt 0)

New User

10+ Year Member

joined:May 17, 2004
votes: 0

I have a database with on table in it the table has 5 columns one of the columns is named links I would like to be able to display a link to a persons homepage in there row.
QUESTION 1 is how do I save them in the MYSQL monitor (how do I script them in)

Question 2 Is what more do I need to add to my php script to display them if anything. BELOW IS MY PHP SCRIPT TO RETIREVE DATA.

$conn = mysql_connect("localhost","","");
$person = $_POST['sex'];
$myage = $_POST['dob'];
$myheight = $_POST['size'];
$resultID = mysql_query("SELECT * FROM $person WHERE age in ($myage) and height in ($myheight) ",$conn);
print "<table border = 1><tr><th>id</th>";
print "<th>name_first</th><th>name_last</th>";
print "<th>age</th><th>height</th><th>weight</th>";
while ($row = mysql_fetch_row($resultID))
print "<tr>";
foreach ($row as $field)
print "<td>$field</td>";
print "</tr>";
print "</table>";

Thanks for help everyone has allways been helpful.

Phil from Orlando Florida

4:36 pm on May 22, 2004 (gmt 0)

New User

10+ Year Member

joined:Apr 16, 2004
votes: 0

Phil, I am a relative newbie, but my solution is simply to store the link as text. I generally strip off the http:// at the start if it exists and put it back when I retrieve the string so as to be sure that it in a standard format.

To display the link as an active link you need a line like:

echo "<a href='http://".$yourresult."'>Some explanatory text or repeat the link text</a>";


[edited by: jatar_k at 5:03 pm (utc) on May 22, 2004]
[edit reason] no sigs thanks [/edit]