RE: [PHP] Exporting Dbase to CSV

From: Date: Thu, 26 Aug 2004 14:53:20 +0000
Subject: RE: [PHP] Exporting Dbase to CSV
Groups: php.general 
Request: Send a blank email to php-general+get-194801@lists.php.net to get a copy of this message
[snip] I'm using MySQL Jay I can present the results in a table easy enough and if I replace the TD TAGs with commas etc. I get a screen output that resembles a CSV file but need to go that one step further and don't know how... [/snip] Use CSV (without the table thing) and place Excel header definitions in the script.... header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: inline; filename=\"excel.xls\""); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); and then an example from one of our spreadsheet outputs.... print($rowage->TmsNoLines . ","); print($rowage->TmsStatus . ","); print($rowage->TmsPaidDate . ","); print(number_format($rowage->Current, 2, '.', '') . ","); print(number_format($rowage->Thirty, 2, '.', '') . ","); print(number_format($rowage->Sixty, 2, '.', '') . ","); print(number_format($rowage->Ninety, 2, '.', '') . ","); print(number_format($rowage->OneTwenty, 2, '.', '') . ",\n"); We usually make the link open in a new window when outputting sheets like this. All the user needs to do is save it locally at that poiint.

« previous php.general (#194801) next »