I am trying to run a csv export on a MySQL Database via PHP. Everything is working fine until I get to the description field. Where each line is terminated by new lines in the text field. So for every line in the text field, I get a new line in the CSV. When all I want is a new line for the end of the row.
I’ve tried a few solutions so far, including:
REPLACE(description, '\r\n', '\n')
str_replace( array( "\r" , "\n" ) ,'\n' , $data);
description = REPLACE(description, description, TRIM(BOTH '\r\n' FROM description))
Any help is appreciated.
Why are you replacing it with
\n?Try to replace it with an empty string instead, like
''. Try to replace\r\nwith""and\nwith""