PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am trying to export a table to excel but I have two comment fields and when the users enter a comment they put commas and other punctuation. The problem I am having is that I need to clean up the comment fields so they will export correctly. I tried using mysql_real_escape_string but I dont think it is working.
I am new to php and I am not sure if this is correct. I wrote this function to try to clean up my comment fields that has ? and , and it is causing problems when I try to convert the file to csv file.
Please tell me if this is correct or if there is a better way to do this??
I am not sure if it is correct. What I was trying to do is do the first pass and clean it and store it to $comm1 is should remove the ? marks but it's not.
Then I wanted to do a second pass and remove the ,'s from $comm1 that iis already clean of ? marks
then I want to return the cleaned $comm2 to the row.
I know there must be something wrong because it is not cleaning the fields. But I am not receiving any errors????
One more thing can you tell me what these formatting things are called
\n \r
so I can search for them and read more about them? When I replace the ? or , it is cutting the line off and I want it to continue as part of the same string.
"\n\r" makes a new line in the text output.
As CSV format doesn't support fields with multiple lines (every new line in the file is a new record) you can not use it in this situation.