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
https://forums.phpfreaks.com/topic/231712-hyperlink/
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
https://forums.phpfreaks.com/topic/231712-hyperlink/#findComment-1192265
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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