Jump to content

Add Hyperlinks to table cell info


rscott7706

Recommended Posts

Hey all. I am creating a query table that will sample my MYSQL database with various fields.

I found this code, and it works great except I need to assign hyperlinks to fields ($row) 12 and 13.

I know it is a simple thing (I think), just adding the opening <A HREF and closing <a> to the code lines of 12 and 13, but I am at a loss as the the right syntax. Can you help?

echo "<table cellpadding=10 border=0>";
while($row = mysql_fetch_row($result)) {
echo "<tr>";
echo "<td>".$row[1]."</td>";
echo "<tr>";
echo "<td>" . $row[12]."</td>";
echo "<tr>";
echo "<td>".$row[13]."</td>";
echo "</tr>";
}
echo "</table>";

Thanks in advance!!
Link to comment
Share on other sites

umm.. assuming that the value of $row[x] is the url, shouldn't this work?


echo "<table cellpadding=10 border=0>";
while($row = mysql_fetch_row($result)) {
echo "<tr>";
echo "<td>".$row[1]."</td>";
echo "<tr>";
echo "<td>[!--coloro:blue--][span style=\"color:blue\"][!--/coloro--]<a href='$row[12]'>[!--colorc--][/span][!--/colorc--]" . $row[12]."[!--coloro:blue--][span style=\"color:blue\"][!--/coloro--]</a>[!--colorc--][/span][!--/colorc--]</td>";
echo "<tr>";
echo "<td>[!--coloro:blue--][span style=\"color:blue\"][!--/coloro--]<a href='$row[13]'>[!--colorc--][/span][!--/colorc--]".$row[13]."[!--coloro:blue--][span style=\"color:blue\"][!--/coloro--]</a>[!--colorc--][/span][!--/colorc--]</td>";
echo "</tr>";
}
echo "</table>";
Link to comment
Share on other sites

more like this

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]


echo "<table cellpadding=10 border=0>";
while($row = mysql_fetch_row($result)) {
echo "<tr>";
echo "<td>".$row[1]."</td>";
echo "<tr>";
echo "<td>[!--coloro:blue--][span style=\"color:blue\"][!--/coloro--]<a href='" . $row[12] . "'>[!--colorc--][/span][!--/colorc--]" . $row[12]."[!--coloro:blue--][span style=\"color:blue\"][!--/coloro--]</a>[!--colorc--][/span][!--/colorc--]</td>";
echo "<tr>";
echo "<td>[!--coloro:blue--][span style=\"color:blue\"][!--/coloro--]<a href='" . $row[13] . "'>[!--colorc--][/span][!--/colorc--]".$row[13]."[!--coloro:blue--][span style=\"color:blue\"][!--/coloro--]</a>[!--colorc--][/span][!--/colorc--]</td>";
echo "</tr>";
}
echo "</table>";
[/quote]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.