I would do it like this:

$build = " '%s','%s','%s','%s'\n";
$build = sprintf($build,$field1,$field2,$field3,$fieldN);

you could also try escaping the comma. if this doesn't work you can always
just dump to html tables and save the file as *.xls (excel spreadsheet);
excel understands html tables and simple markup as spreadsheet data.

ie:

<html>
<table>
<tr>
<td>field1</td><td>field2</td><td>field3</td><td>field4</td>
</tr>
<tr>
<td>value1</td><td>value2</td><td>value3</td><td>value4</td>
</tr>
</table>
</html>


~phillip
"Jake McHenry" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> ----- Original Message ----- 
> From: "Paul Furman" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, February 07, 2004 1:56 AM
> Subject: [PHP] Re: excel output question
>
>
> > Single quote everything should work.
> >
> > Jake McHenry wrote:
> >
> > > Hi everyone. I'm outputing payroll information to an excel csv file,
and
> when anyone get's paid over 1k, the amount is split into two fields
because
> of the comma in the amount. Is there anyway I can tell excel that this
> particular comma is not a deliminator?
> > >
> > > Thanks,
> > > Jake
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> like this?
>
> output =
>
"'$fullname',,'$location',,'$regularhours','$vachours','$sickhours','$compho
>
urs','$mischours','$wopyhours','$sefahours','$biweekly[0]','$adjustedtime',,
> ,,,'$sub401k
> ','$payrate','$gross5'\n";
>
> That just filled my spreadshit with quotes around everything... still the
> amounts larger than 1k are in 2 columns......
>
> did I do something wrong?
>
> Thanks,
> Jake

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to