RCS Posted April 19, 2008 Share Posted April 19, 2008 I have a form where I input a link and a description for that link to a mysql database, the problem that I'm having is when I submit the link http://somesite.com the out come is just that and I need it to be an actual hyperlink, can someone tell me how to do this. Here is my code <?php include("dbinfo.inc"); $con = mysql_connect($db_host, $db_user, $db_pass) or die ("Could not connect to database."); mysql_select_db("$db_name", $con); $result = mysql_query ("SELECT * FROM service ORDER BY id"); echo "<table border='1'> <tr> <th width='200'>Service Links</th> <th width='200'>Description</th> </tr>"; while($row = mysql_fetch_array ($result)) { echo "<tr>"; echo "<td>" . $row['links'] . "</td>"; [color=orange]//THIS SHOULD BE HYPERLINK[/color] echo "<td>" . $row['description'] . "</td>"; echo "</tr>"; } echo "</table>"; ?> Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/101886-solved-links-from-mysql-database/ Share on other sites More sharing options...
unidox Posted April 19, 2008 Share Posted April 19, 2008 Try using <a>Link</a> Link to comment https://forums.phpfreaks.com/topic/101886-solved-links-from-mysql-database/#findComment-521420 Share on other sites More sharing options...
RCS Posted April 19, 2008 Author Share Posted April 19, 2008 Not sure what you mean SEE I TYPE IT INTO THE FORM LIKE http://somesite.com AND CALL IT LIKE echo "<td>" . $row['links'] . "</td>"; BUT IT SHOWS UP LIKE http://somesite.com BUT NOT HYPERLINK so how would I call it from the database as a hyperlink??? Link to comment https://forums.phpfreaks.com/topic/101886-solved-links-from-mysql-database/#findComment-521425 Share on other sites More sharing options...
RCS Posted April 19, 2008 Author Share Posted April 19, 2008 Not sure I understand what you mean?? Link to comment https://forums.phpfreaks.com/topic/101886-solved-links-from-mysql-database/#findComment-521426 Share on other sites More sharing options...
Rohan Shenoy Posted April 19, 2008 Share Posted April 19, 2008 while($row = mysql_fetch_array ($result)) { echo "<tr>"; echo "<td><a href=\"".$row[links]."\">".$row[links]."</a></td>"; [color=orange]//THIS SHOULD BE HYPERLINK[/color] echo "<td>" . $row['description'] . "</td>"; echo "</tr>"; } echo "</table>"; Link to comment https://forums.phpfreaks.com/topic/101886-solved-links-from-mysql-database/#findComment-521429 Share on other sites More sharing options...
RCS Posted April 19, 2008 Author Share Posted April 19, 2008 Thank you very much, I have one more question for you. what if I wanted to have it so echo "<td><img src =\"upload/" . $row['name']."\"></td>"; has a hyperlink added to the image say http://somesite.com Link to comment https://forums.phpfreaks.com/topic/101886-solved-links-from-mysql-database/#findComment-521433 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.