RE: Exporting data in mysql to an excel sheet

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

 



after doing the implode stuffs with the result set.

use header function like this

header("Content-Disposition: attachment; filename=yourfilename.csv");
header("Content-Type: text/csv; charset=UTF-8");
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: post-check=0, pre-check=0", false );
header("Content-Length: ".strlen($cont));
echo $cont;

hope this will help you , cheers :)

"Atkinson, Robert" <ratkinson@xxxxxxxxxxxxx> wrote:                               There's a class on phpclasses.org
 (http://www.phpclasses.org/browse/package/2037.html) that can be used to
 create Excel files.
  
 Rob.
 
 ________________________________
 
 From: php-objects@xxxxxxxxxxxxxxx on behalf of Sudhakar
 Sent: Sun 10/28/2007 10:31 AM
 To: php-objects@xxxxxxxxxxxxxxx
 Subject:  Exporting data in mysql to an excel sheet
 
 I have developed a reporting page using php which will display the
 number of records from a table to the browser. This works fine,
 however i would like to provide user an option where
 1. they can view the report in an excel sheet which can be opened or
 saved with a dialog box and
 2. i would like the field names to be added in the first row of the
 excel sheet exactly how it happens while exporting a table from Myphp
 admin interface.
 
 Please provide the code for this. Any help will be greatly appreciated.
 
 ***********************************************************************************
 Any opinions expressed in email are those of the individual and not necessarily those of the company. This email and any files transmitted with it are confidential and solely for the use of the intended recipient 
 or entity to whom they are addressed. It may contain material protected by attorney-client privilege. If you are not the intended recipient, or a person responsible for delivering to the intended recipient, be advised that you have received this email in error and that any use is strictly prohibited.
 
 Random House Group + 44 (0) 20 7840 8400
 http://www.randomhouse.co.uk
 http://www.booksattransworld.co.uk 
 http://www.kidsatrandomhouse.co.uk
 Generic email address - enquiries@xxxxxxxxxxxxxxxxx
 
 Name & Registered Office:
 THE RANDOM HOUSE GROUP LIMITED
 20 VAUXHALL BRIDGE ROAD
 LONDON
 SW1V 2SA
 Random House Group Ltd is registered in the United Kingdom with company No. 00954009, VAT number 102838980
 ***********************************************************************************
 
 [Non-text portions of this message have been removed]
 
 
     
                               

 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux