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
https://forums.phpfreaks.com/topic/8519-add-hyperlinks-to-table-cell-info/
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>";
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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.