Reputation: 11
I have a table news
, it has a column description
. In the descriptions' column I use <p>
tags. I want all the <p>
tags to be changed into <p itemprop="description">
. How can I do it?
Upvotes: 0
Views: 115
Reputation: 47321
select replace(description, '<p>', '<p itemprop="description">') from news
It is not recommended. My suggestion is to pull the original data from MySQL, then perform the string replacement in the UI or frontend scripts.
Upvotes: 0
Reputation: 866
Try this;
UPDATE `news`
SET `description` = REPLACE(description, '<p>', '<p itemprop="description">')
https://dev.mysql.com/doc/refman/5.7/en/string-functions.html
Upvotes: 1