rscott7706 Posted April 27, 2006 Share Posted April 27, 2006 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 More sharing options...
sanfly Posted April 27, 2006 Share Posted April 27, 2006 So $row[12] and $row[13] are the URLs for the link? Link to comment https://forums.phpfreaks.com/topic/8519-add-hyperlinks-to-table-cell-info/#findComment-31196 Share on other sites More sharing options...
.josh Posted April 27, 2006 Share Posted April 27, 2006 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 https://forums.phpfreaks.com/topic/8519-add-hyperlinks-to-table-cell-info/#findComment-31210 Share on other sites More sharing options...
sanfly Posted April 27, 2006 Share Posted April 27, 2006 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 https://forums.phpfreaks.com/topic/8519-add-hyperlinks-to-table-cell-info/#findComment-31215 Share on other sites More sharing options...
.josh Posted April 27, 2006 Share Posted April 27, 2006 well that's just coding preference. either way works (assuming that that's what he wants to do). Link to comment https://forums.phpfreaks.com/topic/8519-add-hyperlinks-to-table-cell-info/#findComment-31218 Share on other sites More sharing options...
rscott7706 Posted April 27, 2006 Author Share Posted April 27, 2006 Yes, the line numbers were the hyperlinks.Works great!! Thanks all, I appreciate your responses!! Link to comment https://forums.phpfreaks.com/topic/8519-add-hyperlinks-to-table-cell-info/#findComment-31312 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.