Jump to content

Archived

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

rscott7706

Add Hyperlinks to table cell info

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!!

Share this post


Link to post
Share on other sites
So $row[12] and $row[13] are the URLs for the link?

Share this post


Link to post
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>";

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites
well that's just coding preference. either way works (assuming that that's what he wants to do).

Share this post


Link to post
Share on other sites
Yes, the line numbers were the hyperlinks.

Works great!! Thanks all, I appreciate your responses!!

Share this post


Link to post
Share on other sites

×

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.