Solved

Cr / lf in MySQL text

Posted on 2014-12-19
4
167 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 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

Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

Question has a verified solution.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

724 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