Page 1 of 1

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

Posted: Fri Mar 12, 2004 6:17 pm
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

Posted: Fri Mar 12, 2004 6:29 pm
by andre_c
Have you written any of the code so far? Can you show some of it?

Posted: Sat Mar 13, 2004 1:55 am
by llamaclock
i havent written any of it, i know how to write it if thats what your asking

Posted: Mon Mar 15, 2004 2:49 am
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>