Page 1 of 1

Hyperlink?

Posted: Fri Mar 25, 2011 12:55 pm
by Vinnar
Hey guys

Just a quick question:

How to embed hyperlink into a database cell?

Basically I echo out a table on the user interface of my site

and there's an URL in one of the cells

I want the user to access it by clicking on it, without copying and pasting the URL into the URL bar of the browser

I tried updating the cell in phpmyadmin using <a href = http://www.example.com>http://www.example.com</a> but didn't work out, the resulting cell only had the text format

Any help would be appreciated

Thanks.

Re: Hyperlink?

Posted: Fri Mar 25, 2011 1:53 pm
by califdon
First, do yourself a favor and learn the way databases work. There is no such thing as a "cell" in a database. That's more than just terminology, it is fundamental to thinking about databases instead of spreadsheets, which do have cells.

Second, your problem has nothing at all to do with the database. When you use the data from the database to build your HTML, that's where you create a hyperlink, because the "anchor" syntax (<a href=...) is part of HTML, not part of the data.

So you should have PHP code which does something like this:

Code: Select all

echo "<td><a href='" . $row['link'] . "'>" . $row['link'] . "</a></td>";