Monday, 15 March 2010

mysql - PHP code to present query result present as html, and add hyperlink to text that is a url -


My database $ data contains a cell, any data that may contain the URL may contain url in some of that data

To use mysql, I need to send php back to the text of the cell, whatever url it is. I found the preg_replace function on the overflow other place but it is not working.

I am trying to find a code that will remove $ data, then display $ data as text and hyperlink url.

I found this:

  preg_replace ('/ \ b (https ?: \ / \ / (. +?)) \ B /', '& lt; A href = "\ 1" & gt; \ 1 & lt; / a & gt; ', $ text);  

but a) This is not working and b) I need a statement to extract $ data first

  $ data = \ preg_replace ('/ \ b (https ?: \ / \ /.+)\b/i', '& lt; a href = "\ 1" & gt; ; \ 1 & lt; / a & gt; ', $ data);  

No comments:

Post a Comment