Jump to content

[SOLVED] Links from mysql database.


RCS

Recommended Posts

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

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

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>";

Archived

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

×
×
  • Create New...

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.