?
Solved

Cr / lf in MySQL text

Posted on 2014-12-19
4
Medium Priority
?
180 Views
Last Modified: 2014-12-19
I have this text in a MySQL database "blob" field:

"Initially a warranty call but water was shut off and we spent a few days troubleshooting and fixing leaks on old system that had been disconitued.

When we got everything working we made adjustments on new rotors and rebuilt 1 1/2" valve that was stuck open (warranty)"

I want to eliminate the cr / lf characters when I extract it into a php program.

How can I do that?

Thanks.
0
Comment
Question by:Richard Korts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 40509593
UPDATE tablename set fieldname= REPLACE(REPLACE(fieldname,'\r',''),'\n','')

Open in new window

0
 

Author Comment

by:Richard Korts
ID: 40509659
Gary,

I did the equilavent of that if php, using str_replace, like this:

$wc = str_replace('\r', ' ', $wc);
$wc = str_replace('\n', ' ', $wc);

$wc being the extracted value from the database.

Has no effect.

The text was probably entered on an iPad. Does that make a difference?

Thanks
0
 

Author Closing Comment

by:Richard Korts
ID: 40509678
Works in MySQL. I had preferred not to change the database text, but ..............
0
 
LVL 58

Expert Comment

by:Gary
ID: 40510307
Ahh you didn't say you wanted to do it in PHP, your zones were just MySQL
It would depend on how the CR's were being interpreted and stored in the DB i.e are they using the HTML tag of <br>
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question