Reputation: 3777
I'm selecting a text column in a MySQL query for export to a csv file in a PHP script. It turns out the text column has carriage returns which is causing an issue with import on the other end.
How do I remove carriage returns while making the query and just present the text? Here is my current query:
SELECT marketing_remarks AS MarketingRemarks WHERE column = "blah"
Upvotes: 1
Views: 3404
Reputation: 5068
You can either do it in the query (as per Fredd's answer), or in the PHP:
str_replace("\r", '', $result); // remove carriage returns
there will be factors which will determine which is the best approach for you
Upvotes: 1
Reputation:
SELECT REPLACE(marketing_remarks, '\r', '') AS MarketingRemarks WHERE column = "blah"
Something like this?
Upvotes: 4