Re: Send .csv file to browser [message #170039 is a reply to message #170038] |
Wed, 06 October 2010 16:28 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 10/6/2010 12:25 PM, Peter H. Coffin wrote:
> On Tue, 05 Oct 2010 11:11:24 -0400, sheldonlg wrote:
>> On 10/5/2010 11:06 AM, Derek Turner wrote:
>>> On Tue, 05 Oct 2010 10:55:44 -0400, sheldonlg wrote:
>>>
>>>> The user can then cut and paste it into a file or you can put in code
>>>> for the user to download that piece.
>>>>
>>>> Another approach is to output an Excel file and the user can then output
>>>> from that Excel file to a .csv file.
>>>
>>> Why not? Because it's not very elegant, is it?
>>
>> WGAS? Why does something have to be "elegent"? All it has to do is:
>>
>> 1 - Work reliably.
>> 2 - Be maintainable.
>>
>> Besides, haven't you ever heard of K.I.S.S. or Occam's razor?
>>
>> (WGAS means "who gives a shit").
>
> 'cause the method fails miserably at 1.
>
> --------------------------
> $ cat foo.php
> <?php
> $recs = array();
> $recs[] = "This is the first line.";
> $recs[] = "Line the second, number 2.";
> $recs[] = "Line 3, continuing.";
> print_r($recs);
> $line = implode(',', $recs);
> print_r($line);
> ?>
> $ php -f foo.php
> Array
> (
> [0] => This is the first line.
> [1] => Line the second, number 2.
> [2] => Line 3, continuing.
> )
> This is the first line.,Line the second, number 2.,Line 3, continuing.$
> --------------------------
>
> How many variable columns are there in that output. Three? Five? None?
>
Which has the same problem as Sheldon's - parsing the .csv will give:
This is the first line.
Line the second
number 2
Line 3
continuing.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|