Jump to content

Hyperlink?


tommy168

Recommended Posts

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.

Link to comment
Share on other sites

Wrap your mysql table output with this:

 

$description = preg_replace("#([\t\r\n ])([a-z0-9]+?){1}://([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)#i", '\1<a href="\2://\3" target="_blank" rel="nofollow">\3</a>', $description);
$description = preg_replace("#([\t\r\n ])(www)\.(([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)#i", '\1<a href="http://\2.\3" rel="nofollow" target="_blank">\2.\3</a>', $description);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.