I'm exporting from mysql to csv and I have to do the formatting within php (can't use an 'into file' select statement).
Got everything working fine apart from some fields which have got off characters in and line breaks are causing a problem when opening the csv in excel.
At the moment I'm using "\r\n" to end a line and "," between fields and wraping everything in "'s
So my csv looks like this:
"data","more data","and some more"\r\n
"another row", "", "some data"\r\n
and so on.
But I'm getting some odd characters in the database which show up as boxes and sometimes the data doesn't all go into one cell in excel which then knocks all the formatting out.
Should I be stripping any odd characters? And if so how?
Any help with this would be much appreciated!