I'm trying to replace junk in my DB:
UPDATE xxxxxx set body = replace(body,'<p></p><p>','<p>')
Some tags are not getting replaced because there are line breaks between them...
In phpmyadmin I see this:
yadda yadda<p></p>
<p>yadda yadda
This didn't work..
UPDATE xxxxxx set body = replace(body,'\\r\\n','');
UPDATE xxxxxx set body = replace(body,'\\r','');
UPDATE xxxxxx set body = replace(body,'\\r','');
WHERE ARE THE BREAKS COMING FROM??
Any ideas?
Remove and Replace Carriage Returns and Line Breaks in SQL Using SQL to remove a line feed or carriage return means using the CHAR function. A line feed is CHAR(10); a carriage return is CHAR(13).
The Trim() function is used to remove new line characters from data rows in MySQL.
Remove characters from string using TRIM() Name of the table. Name of the column whose values are to be updated. The characters to be removed from each value. BOTH: used when we want to remove characters from beginning and end.
UPDATE xxxxxx set body = replace(body,'\r\n','');
UPDATE xxxxxx set body = replace(body,'\n','');
Try the above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With