Re: csv export...?
| From: | David T-G | Date: | Fri, 09 Jan 2004 16:04:21 +0000 |
| Subject: | Re: csv export...? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-32341@lists.php.net to get a copy of this message | ||
Tristan --
..and then Tristan.Pretty@risk.sungard.com said...
%
% Google is not my friend today...
..
% Now I have found loadsa sites that let me upload a csv file, but not the
% other way around...
You might check PHPClasses to see if anyone has done this; I wouldn't be
surprised. In general, though, you declare the file type and then run
through a loop. From some code I have:
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)
print "\n" ; # end the row
$total[$d]++ ; # keep count
} # if($age||$ftime) // }}}
} # if(is_file)
} # while(readdir) // }}}
%
% Anyone care to help?
There ya go :-)
HTH & HAND & Happy New Year
:-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!