Search code examples
phphrefecho

displaying words from db as links in php


i have words like 123.com , 234.org in database how to display them as links?

<?php
$con=mysql_connect("localhost","root","123");
mysql_select_db("www",$con);

$result=mysql_query("SELECT * FROM Tag");

for ($c=0; $c< mysql_num_rows($result); $c++)
{
$f=mysql_fetch_array($result);

###########echo $f['name']." ";
}
 mysql_close($con);
?>

Solution

  • You need to output the HTML for a link. Something along the lines of:

    print "<a href=\"" . $url . "\">" . $f['name'] . "</a>";
    

    replacing url with the site URL you want the link to go to. It sounds like it might also be $f['name'].