473,804 Members | 2,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

php to display mysql output text as hyperlink

Hi,

Not sure if this goes to PHP or mySQL group (or both!).

I've got a home brewed blog started using PHP and mySQL to store and
display the entries/postings.

I've figured out that I could format the way the entries are displayed
from the database using nl2br2($string) to properly display paragraph
breaks.

How can I parse the output and display a hyperlink one types in the
body of the entry, into an actual link.

If the body text looks like this for example:
Today I went to the zoo. If you want to visit the zoo, look at their
homepage at www.zoo.com I think you'll like it a lot.

How can I get the output to be parsed, recogonize http:// or www. and
convet the plain text to an actual hyperlink?

Much thanks to those who can offer insight!!

Chris

Aside from the dull entry,

Aug 23 '07 #1
1 2531
..oO(xx75vulcan )
>How can I parse the output and display a hyperlink one types in the
body of the entry, into an actual link.

If the body text looks like this for example:
Today I went to the zoo. If you want to visit the zoo, look at their
homepage at www.zoo.com I think you'll like it a lot.

How can I get the output to be parsed, recogonize http:// or www. and
convet the plain text to an actual hyperlink?
Could be done with a regular expression, but it won't be reliable. Not
every URL starts with HTTP or a leading 'www'. What about using BBCode
or something like that?

Micha
Aug 23 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9510
by: deko | last post by:
I store hyperlinks as text in a table like this: Invoice11-21-2003.pdf#file://P:\Finance\PrefVendors\Receipts\Invoice11-21-20 03.pdf I need to run a report that lists the documents - or whatever the display text of the hyperlink is. As it is now, the entire hyperlink appears in the report - I'm trying to display just the document name.
6
2246
by: dee | last post by:
Here is a a list of my hyperlinks in my home page: <A class="theclass" href="Default.aspx">Home</A> <A class="theclass" href="Search.aspx">Search</A> <A class="theclass" href="Help.aspx">Help</A> And these are defined in Styles.css file: a.theclass:link, a.theclass:visited { display: block;
5
2510
by: Stephen | last post by:
Hi, Is there anyway I can make a column thats databound into a hyperlink to navigate to another page? Suppose I have 3 columns: SortOrder, Description, UserName for eg: <Columns> <asp:HyperLinkColumn Text="View" DataNavigateUrlField="UserId" DataNavigateUrlFormatString="ViewInfo.aspx?id={0}">
6
5994
by: Bill Nguyen | last post by:
I'm getting data from a mySQL database (default char set = UTF-8). I need to display data in Unicode but got only mongolian characters like this: Phạm Thị Ngọc I changed the textbox font to Arial Unicode MS but still not working. Do I need conversion of data stored in mySQL database before displaying? Thanks Bill
1
3219
by: satish.vell | last post by:
Hi, I have a ASP.NET page inside which I toggle the display of a field using javascript. How can I save this display value between postbacks. Here is my code: <pre>
3
3191
by: BOBss | last post by:
I am using ASP with VBScript. I want to query an access database username field, and display the output as a hyperlink on an a webpage.The webpage will display all records. I then need to be able to select a given record(hyperlink), and display all of the fields for that record on another webpage so I can execute some code against it. Can anyone point me to some sample code so I can get an idea of how to accomplis this? Thanks in...
0
1578
by: netventuresmarketing | last post by:
Ok so you have already figured out with a name like netventuresmarketing that Im a Internet marketing type trying to teach myself some simple PHP. I purchased a turnkey program to set up a free directory or free classified site about social Internet marketing .....everything seemed great and all seems to work after *the *install. Then I noticed that there was no where for the member filling out the form to include a URL or link to their...
8
2344
by: kumarboston | last post by:
Hi All, I have a mysql database and 3 pages which queries and returns the data. 1st page(main.html) is just a form in html which takes query from the user and is connected to "form action="index.php"". 2nd page(index.php) has the mysql queries and gives a brief information(one line) about the user query. Now the index.php has a hyperlink to the third page(summary.php) which gives detailed information about the user query. 3rd...
1
1757
by: mramsay | last post by:
Hi there, I have a dynamic hyperlink Baseball. When the user select the hyperlink they are redirected to another page. After that I want to display information on the page from my linkstbl. The information I want to display is Baseball and some text I have entered in the database. I'm having a problem displaying the two fields for Baseball. The two field names are linkdescription and text. How do I get my sql query to pull out the...
0
9714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10599
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10346
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6863
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5531
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.