Re: csv export...?
| From: | David T-G | Date: | Tue, 13 Jan 2004 19:03:09 +0000 |
| Subject: | Re: csv export...? | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-32373@lists.php.net to get a copy of this message | ||
Andre, et al --
[Sorry for the delay...]
..and then Andre Speelmans said...
%
% Hi David,
Hi!
%
% On Fri, Jan 09, 2004 at 11:04:21AM -0500, David T-G wrote:
% >
% > header ("Content-Type: application/csv;") ; # this is a CSV
% > header ("Content-disposition: attachment; filename=authorized-visitors.$d.csv")
; # file name
% > ...
% > [suck in file and dump into $a array]
% > foreach ( array_keys($a) as $ak ) # walk thru the array
% > { print "\"$a[$ak]\"," ; } # print the field (yes, even if
blank)
%
% But this would go wrong if $a[$ak] contained a double quote. Remember you have
Oooh; good point. My input is all sanitized, so " becoamse " and so
on, but for raw data that would definitely be a factor.
% to escape those characters. Can't the database of OP do a dump, like MySQL
% can?
Well, in my case each record is a file on disk, so that doesn't apply.
Thanks & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!