Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating csv file with , in values

Status
Not open for further replies.

spookie

Programmer
May 30, 2001
655
IN
hi,

I am creating a CSV file for report generation.
The problem is if the value contains "," , it is getting stored in a seperate column..
ie value is abc,xyz then abc and xyz are getting stored in two different columns.how can i avoid this.(i tried storing values with " surrounding them but of no use.)
also i am using while loop for multiple records.
right now the values are getting stored in a single line.
how can i get diff records in seperate rows of an excel file.

Thanks in advance

spookie --------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
first passing Idea:
strip out all commas before creating your csv -> str_replace(',','',$source);

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Try using tab-delimiting instead of commas, this will work just as well with excel.

so when you are outputting your data using php, separate the fields with "\t" instead of ","
 
Thanks guys,

I will try that out..

spookie
--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top