Alexandre Faustino
Alexandre Faustino

Reputation: 17

Remove different links from MySQL table

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>

Upvotes: 0

Views: 704

Answers (1)

Makis
Makis

Reputation: 1244

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

Upvotes: 1

Related Questions