0

How i could remove different links i have in a MySQL field in many rows? I couldn't find a query for that.

I don't have much experience with MySQL, the ideal solutions would be something that begins with something and ends with something.

Example: On table 'ads' i have a field called 'description' that has the ad description text. I have links inside the descriptions and i want to remove them all, but those links have different urls from ads to ads. I don't want to delete the text of the link, just the link itself <a class="something" href="http://someurl.com">Link text</a>

1 Answers1

1

Please give a better explanation of your problem and a sample of code. Although, if i'm right on what you want to achieve, you might need something like this below.

Example:

UPDATE ads SET description=REPLACE(description,'whatYouWantToDelete','')

The above will remove everything in your column that contains the string foo.

UPDATE:

These might be helpful.

Remove HTML tags from record

Removing links from posts in wordpress using query

Community
  • 1
  • 1
Makis
  • 1,214
  • 3
  • 16
  • 40
  • Hi @Makis, i just add some more information on my question, please see if you understand it. – Alexandre Faustino May 22 '15 at 22:34
  • I thing this post will help you http://stackoverflow.com/questions/12030143/sql-statement-to-remove-part-of-a-string – Makis May 22 '15 at 22:46
  • No because the rest of the html tag is not removed. Also the replace souldn't work because the urls are different i am correct? – Alexandre Faustino May 22 '15 at 22:51
  • Yes the replace should not work, that was my answer before you edited your post. I'm searching for it, i hope i can help you! – Makis May 22 '15 at 22:53
  • Check those please.http://stackoverflow.com/questions/2627940/remove-html-tags-from-record and http://stackoverflow.com/questions/19356897/removing-links-from-posts-in-wordpress-using-query – Makis May 22 '15 at 22:57