Re: csv export...?

From: Date: Sun, 11 Jan 2004 10:40:42 +0000
Subject: Re: csv export...?
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-32355@lists.php.net to get a copy of this message
Hi David, On Fri, Jan 09, 2004 at 11:04:21AM -0500, David T-G wrote: > Tristan -- > > % 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) But this would go wrong if $a[$ak] contained a double quote. Remember you have to escape those characters. Can't the database of OP do a dump, like MySQL can? [ rest of script stripped ] -- Regards, Andre

« previous php.db (#32355) next »