Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySql & PHP - Making a link out of data collected

Status
Not open for further replies.

New2Biz

Programmer
Oct 23, 2007
12
US
If I have one screen where I have someone enter their website into a field that uses PHP to post it into a MySql database....how can I make that text a hyperlink when it is posted on another page. this other page woudl be a page where the contents of the MySql database is displayed.

For this example, say that I have a field within the database titled "Website" and when the contents of that field are displayed...I want it to be a clickable link.

I am sure I need coding for it, but do I have to have the field within the database set to something other than text?

Thanks for your help.
 
This should work:

echo "<a href=\"['url']}\">" . $Row['url'] . "</a>";

Where 'url' is the column name where the url is stored.
 
As Nevada Jones pointed out, its just a matter of outputting the appropriate html around the value taken from the DB.


Code:
$url="[URL unfurl="true"]http://www.someplace.com";[/URL]

echo "<a html='" . $url . "'>This is a link to " . $url . "</a>";

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top