add link to a database and reading it as a clickable link

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
llamaclock
Forum Newbie
Posts: 3
Joined: Sun Mar 07, 2004 1:21 am
Location: california

add link to a database and reading it as a clickable link

Post by llamaclock »

I want to create a system on my site where my users can add there own link to a database. When I read from the database I want it to show up as a clickable link not just a site url in text.

Thanks
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Post by andre_c »

Have you written any of the code so far? Can you show some of it?
llamaclock
Forum Newbie
Posts: 3
Joined: Sun Mar 07, 2004 1:21 am
Location: california

Post by llamaclock »

i havent written any of it, i know how to write it if thats what your asking
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Post by andre_c »

Just make sure that when you display it, you wrap an anchor tag around it:

Code: Select all

<?
$query = mysql_query("select * from table_name where user='$user'") or die(mysql_error());
$row = mysql_fetch_array($query);

?>
<a href='<? echo $row['link']; ?>'><? echo $row['link']; ?></a>
Post Reply