AdRock Posted August 17, 2006 Share Posted August 17, 2006 I am trying to display sponsors hyperlinks that is stored in MySQL in a table column.I can display them if I'm just echoing the database but if i try and put anchor tags around the hyperlink it displays nothingThis code will work[code]$q = mysql_query("SELECT * FROM `sponsors` ORDER BY name ASC LIMIT $set_limit, $limit"); if(!$q) die(mysql_error()); $err = mysql_num_rows($q); if($err == 0) die("No matches met your criteria."); $numofrows = mysql_num_rows($q);//Results per page: **EDIT LINK PATH** //show data matching query: echo "<table border=\"0\">\n";echo "<tr bgcolor=\"lightblue\"><th width=\"200\">Name</th><th width=\"140\">Location</th><th width=\"300\">URL</th></tr>\n";for($i = 0; $i < $numofrows; $i++) { $row = mysql_fetch_array($q); //get a row from our result set if($i % 2) { //this means if there is a remainder echo "<tr bgcolor=\"yellow\">\n"; } else { //if there isn't a remainder we will do the else echo "<tr bgcolor=\"white\">\n"; } echo "<td>".$row['name']."</td><td>".$row['location']."</td><td>".$row['url']."</td>\n"; echo "</tr>\n";}//now let's close the table and be done with itecho "</table>\n";[/code]Unless i change this[code]echo "<td>".$row['name']."</td><td>".$row['location']."</td><td>".$row['url']."</td>\n";[/code]to this[code]echo "<td>".$row['name']."</td><td>".$row['location']."</td><td><a href='".$row['url']."'</a></td>\n";[/code]I know there is something dodgey about the anchor link but i can't put my finger on it Link to comment https://forums.phpfreaks.com/topic/17846-displaying-hyperlinks-in-table-stored-in-database-resolved-and-fast/ Share on other sites More sharing options...
trq Posted August 17, 2006 Share Posted August 17, 2006 Try...[code=php:0]echo "<td>".$row['name']."</td><td>".$row['location']."</td><td><a href='".$row['url']."'>".$row['name']."</a></td>\n";[/code] Link to comment https://forums.phpfreaks.com/topic/17846-displaying-hyperlinks-in-table-stored-in-database-resolved-and-fast/#findComment-76219 Share on other sites More sharing options...
AdRock Posted August 17, 2006 Author Share Posted August 17, 2006 Thanks Thorpe....worked a treat Link to comment https://forums.phpfreaks.com/topic/17846-displaying-hyperlinks-in-table-stored-in-database-resolved-and-fast/#findComment-76233 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.