MySQL: Replace BR tags with line breaks
Tip by Progger99 | 2012-02-14 at 21:07
If we want to replace all HTML <br> tags with a line break (newline) directly in MySQL, we can simply use the following function:
UPDATE tab SET col = REPLACE(col, "<br>", "\r\n");
The advantage is obvious: We are performing the command directly in our MySQL database, so that we do not have to read out the data first to edit it in PHP only for re-entering it in our database again after the processing.
About the Author
The author has not added a profile short description yet.
Show Profile
Related Topics
How to Replace multiple Texts at the same Time
Tutorial | 0 Comments
MySQL: Write current Date or Time into Column
Tutorial | 0 Comments
Repair Text Files with mixed Line Breaks
Tutorial | 0 Comments
Rewrite Text Files with a fixed Line Length
Tutorial | 0 Comments
MySQL: Add new Column to a Table
Tutorial | 0 Comments
MySQL: Display search results on multiple pages
Tutorial | 0 Comments
MySQL: Search and Replace directly in MySQL database
Tip | 1 Comment
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.