Ria
Ria

Reputation: 167

Hyperlink to fetched data base field

I am using Dream Weaver

I have coded something like this

while ($row = mysql_fetch_array($result ))
   {
      echo"<tr><td><b>";
      echo $row ['hos_name'];
      echo"</tr></td></b>";
    }

Can I give a hyperlink to 'hos_name'?

Upvotes: 0

Views: 256

Answers (4)

Lawrence Cherone
Lawrence Cherone

Reputation: 46602

the correct way would be something like this:

while ($row = mysql_fetch_array($result ))
{
    echo"<tr>\r";
    echo"<td>\r";
    echo "<a href=\"".$row['hos_link']."\"><b>".$row ['hos_name']."</b></a>\r";
    echo "</td>\r";
    echo "</tr>\r";
}

Upvotes: 0

Hossein
Hossein

Reputation: 4137

Completer than Ronald and MarcB's code:

echo"<tr><td><b>";
echo '<a href="' . $row ['hos_name'] . '">';    <--- start a link
echo $row ['hos_name'];
echo "</a>"                      <--- close the link
echo"</b></tr></td>";

Upvotes: 0

Ronald
Ronald

Reputation: 106

It is still not entirely correct formatted for the rest I think it is allright

  echo"<tr><td><b>";
  echo "<a href="somelink.php">    <--- start a link
  echo $row ['hos_name'];
  echo "</a>"                      <--- close the link
  echo"</b></tr></td>";

only the location of < /b> has changed

Upvotes: 0

Marc B
Marc B

Reputation: 360592

  echo"<tr><td><b>";
  echo "<a href="somelink.php">    <--- start a link
  echo $row ['hos_name'];
  echo "</a>"                      <--- close the link
  echo"</tr></td></b>";

Upvotes: 1

Related Questions