Hello All,

I am displying the paragraph by fetching it from DB using function mysql_result($result1,$i,"Summary")
and here in DB database Summary field contains link (for ex: htttp://google.co.in)
but on UI side, it simply shows htttp://google.co.in not a clickable link.
How to do this ???

in short as my mysql_result() is fetching it as plain text, i want to make it as link if it start by http or https something.

is there any inbuild function in php which converts this automatically or I have to make such function?

my Summary Data is not only of links, it is of plain text and links.
if I have to write a code/function for this then it will take much code for such simple thing.SO I am expecting that there should be such function in php!
which am unaware of :(

Recommended Answers

All 4 Replies

Member Avatar for diafol

There is no automatic function to create a tag around a href as far as I know.

<a href="<?php echo $row['summary'];?>"><?php echo $row['summary'];?></a> 

@diafol: i thing am not clear with my question..
my bad..
Your solution will work when i want to give link to my whole 'Summary' data coming from database.
but i want to give link to only 'link' data as starting with www or http something like this.
And I think I dont have other solution than specal cript/code for detecting the 'link data' from Summary and then gie link.

he he..
thas cool!
thanks @diafol
I was searching for this one line preg expression!
it worked for me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.