I'm guessing that when you are writing your values, you are writing
numbers to the file and not strings. With numbers, the significant
floating-point values are obviously preserved, but a number like 12.00
will be written as just 12. Try either casting the value to a string, or
having PHP auto-cast
("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment;
filename=inventory_report.csv");
print $out; This prints wrong.
-Original Message-----
From: Eric Gorr [mailto:[EMAIL PROTECTED]
Sent: Monday, September 08, 2008 4:21 PM
To: PHP General
Subject: Re: [PH
on: attachment; filename=inventory_report.csv");
>
> print $out; This prints wrong.
>
> -Original Message-
> From: Eric Gorr [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 08, 2008 4:21 PM
> To: PHP General
> Subject: Re: [PHP] CSV output.
>
>
&g
inventory_report.csv");
>
> print $out; This prints wrong.
>
> -Original Message-
> From: Eric Gorr [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 08, 2008 4:21 PM
> To: PHP General
> Subject: Re: [PHP] CSV output.
>
>
> On Sep 8, 2008, at 5:06
l");
header("Content-Disposition: attachment; filename=inventory_report.csv");
print $out; This prints wrong.
-Original Message-
From: Eric Gorr [mailto:[EMAIL PROTECTED]
Sent: Monday, September 08, 2008 4:21 PM
To: PHP General
Subject: Re: [PHP] CSV output.
On Sep 8, 200
Tom Shaw wrote:
> I'm outputting a bunch of numerical values for a spreadsheet to calculate
> total sales among other things on a client shopping cart. I'm running into
> problems with values that contain zeros after the decimal. If a value is
> 234.55 the value outputs fine to the CSV file but if
On Sep 8, 2008, at 5:06 PM, Tom Shaw wrote:
Actually that won't work I tried it. For some reason the .00 shows
up when I
try to manually add a .00. I know weird.
Did you mean to say that it .00 _doesn't_ show up when you try to
manually add a .00?
The value is in the array or string
be
ECTED]
Sent: Monday, September 08, 2008 3:59 PM
To: Tom Shaw; php-general@lists.php.net
Subject: RE: [PHP] CSV output.
> -Original Message-
> From: Tom Shaw [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 08, 2008 3:54 PM
> To: php-general@lists.php.net
> Subject: [PHP]
> -Original Message-
> From: Tom Shaw [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 08, 2008 3:54 PM
> To: php-general@lists.php.net
> Subject: [PHP] CSV output.
>
> I'm outputting a bunch of numerical values for a spreadsheet to
> calculate
> total sales among other things on a clie
It sounds like you simply need to number format the data to ensure that PHP
does not truncate
http://php.net/number_format
If excel, or whatever your using to view the csv file, is truncating then
you will need to properly format that cell.
--
Stephen Johnson c | eh
The Lone Coder
http://www
10 matches
Mail list logo