Solved

Cr / lf in MySQL text

Posted on 2014-12-19
4
134 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
  • 2
  • 2
4 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now