Removing carriage returns in Mysql DB

I am trying to replace the garbage in my DB:

UPDATE xxxxxx set body = replace(body,'<p></p><p>','<p>') 

Some tags are not replaced because there are line breaks between them ...

In phpmyadmin, I see the following:

 yadda yadda<p></p> <p>yadda yadda 

This did not work.

 UPDATE xxxxxx set body = replace(body,'\\r\\n',''); UPDATE xxxxxx set body = replace(body,'\\r',''); UPDATE xxxxxx set body = replace(body,'\\r',''); 

WHERE TO BE DEPARTED?

Any ideas?

+6
source share
2 answers
 UPDATE xxxxxx set body = replace(body,'\r\n',''); UPDATE xxxxxx set body = replace(body,'\n',''); 

Try the above.

+23
source

None of them worked for me. Then I realized that I also had breaks in paragraphs ΒΆ. This request worked for me:

 UPDATE xxxxxx SET body = REPLACE(REPLACE(body, '\r', ''), '\n', ''); 
+7
source

Source: https://habr.com/ru/post/927782/


All Articles