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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with csv files

Status
Not open for further replies.

emms

Programmer
Jan 11, 2001
55
GB
I'm trying to write something which gets records from a database and turns these into a csv file,

the problem i'm having is when comma's appear in the fields, i'm aware that i need to add quotes round all the fields likely to contain comma's but i'm not sure how to do this.

at the moment i have

<cffile action=&quot;append&quot;
file=&quot;#filename#&quot;
output=&quot;#getbuyers.person_id#,#getbuyers.Firstname#,#getbuyers.Lastname# ... #getbuyers.Zipcode#&quot;>

is there anyway i can enclose each of the fields in quotes,
i tried using &amp;quot; and it doesn't work

thanks for any help you can give me

Emma
 
output=chr(??)+&quot;#getbuyers.person_id#&quot;+chr(??)+ ...
where the ?? are the correct code for quotes ;)

or maybe this is enough ?
output=&quot;'#getbuyers.person_id#','#blahblah#', ...&quot;

also try the \&quot; (but i'm almost sure it won't work)
output=&quot;\&quot;#getbuyers.person_id#\&quot;,\&quot;#blahblah#\&quot;, ...&quot;

finally, if none works, then i would replace all the &quot;,&quot; in the output fields with anything, so you're sure there won't be any in the csv file
 
Thankyou very much for your help - this ones been bugging me for ages,

I used:

output=&quot;#chr(34)##getbuyers.person_id##chr(34)#,...&quot;

and it worked :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top