The body column is the type of “text” and normally contains several paragraphs. Is there any easy way to return the snip of matching text using another column in the select statement? In other words, I want to see the websites addresses that people have put into the testimonial, without having to right click on the body column to view the contents in a popup window. Is this even possible without using PHP?
select date(dateAdded), testimonialID, title from testimonials
where body like '%http%' or body like '%.com%';
much easier to do this in php
If I’m understanding, “body” may be something like
Cat ipsum dolor sit amet, http://www.catipsum.com/ kitten for abyssinian.
Sphynx bombay or mouser. Tom siamese jaguar jaguar grimalkin bobcat.
Scottish fold tiger but tom and leopard but kitten.
<a href="http://somesite.org">American</a> bobtail panther.
American bobtail birman birman persian yet cornish rex yet bombay so puma.
Donskoy balinese tom or kitty.
Lion norwegian forest, tabby american bobtail. Manx.
And you want to find the URLs / links.
MySQL does have a lot of String functions, including REGEXP, but if Rudy says using PHP would be easier I take his word for it.
Getting a good regex for URLs is easier than getting one for email addresses, but like many regular expressions, it can get gnarly looking.
Does your current SELECT work OK as far as getting all fields that have a URL / link ?
If so I think the next step is to work on the PHP code to extract the URLs / links from the returned string content
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.