Hyperlinks in SQL Table

  • tomrulez
  • Expert
  • Expert
  • User avatar
  • Joined: Jul 30, 2005
  • Posts: 571
  • Loc: England!!
  • Status: Offline

Post December 17th, 2011, 7:35 am

Hi,
I'm storing some hyperlinks in an sql table and then using some php and an sql query to display them on screen however I can't figure out how to make the url's clickable. Below is my sql code.
Code: [ Select ]
$data = mysql_query("SELECT `progid` , `programme` , `level` , `link`
FROM `progs`
LIMIT 0 , 30")
or die(mysql_error());
Print "<table border cellpadding=3>";
while($info = mysql_fetch_array( $data ))
{
Print "<tr>";
Print "<th>ProgID:</th> <td nowrap='nowrap'>".$info['progid'] . "</td> ";
Print "<th>Programme:</th> <td nowrap='nowrap'>".$info['programme'] . "</td> ";
Print "<th>Level:</th> <td nowrap='nowrap'>".$info['level'] . "</td> ";
Print "<th nowrap='nowrap'>Documentation:</th> <td nowrap='nowrap'>".$info['link'] . " </td></tr>";
}
Print "</table>";

  1. $data = mysql_query("SELECT `progid` , `programme` , `level` , `link`
  2. FROM `progs`
  3. LIMIT 0 , 30")
  4. or die(mysql_error());
  5. Print "<table border cellpadding=3>";
  6. while($info = mysql_fetch_array( $data ))
  7. {
  8. Print "<tr>";
  9. Print "<th>ProgID:</th> <td nowrap='nowrap'>".$info['progid'] . "</td> ";
  10. Print "<th>Programme:</th> <td nowrap='nowrap'>".$info['programme'] . "</td> ";
  11. Print "<th>Level:</th> <td nowrap='nowrap'>".$info['level'] . "</td> ";
  12. Print "<th nowrap='nowrap'>Documentation:</th> <td nowrap='nowrap'>".$info['link'] . " </td></tr>";
  13. }
  14. Print "</table>";


Line 12 deals with printing the url's to the screen. Anyone got any clues?
~ http://tomrulez.deviantart.com/ ~
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post December 17th, 2011, 7:35 am

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8925
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Online

Post December 17th, 2011, 9:07 am

Wouldn't be too hard to do. You would just do something like this:

Code: [ Select ]
print "<th nowrap='nowrap'>Documentation:</th> <td nowrap='nowrap'><a href='". $info['link'] . "'>". $info['link'] . "</a></td></tr>";
Ozzu Hosting - Want your website on a fast server like Ozzu?

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 145 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.