Re: csv export...?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tristan --

...and then Tristan.Pretty@xxxxxxxxxxxxxxxx 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@xxxxxxxxxxxxxxx * society and not sufficient moral courage.
(work) davidtgwork@xxxxxxxxxxxxxxx  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00089.pgp
Description: PGP signature


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux