RE: [PHP-DB] Reporting tool for stats pulled from MySQL db

2003-02-25 Thread Griffiths, Daniel
This is the easiest way but depending on what brouser you use and what version of 
excel you  have the results vary somewhat, try using Content-Disposition: inline and 
then saving the the file from there, this works best for me, but its by no means 
perfect. I seem to recall that someone posted a php class on here that would output in 
excel format correctly but it only works if your using IIS etc.

hope this helps

-Original Message-
From: Lisi [mailto:[EMAIL PROTECTED]
Sent: 25 February 2003 09:41
To: PHP-DB
Subject: [PHP-DB] Reporting tool for stats pulled from MySQL db


I have a stats tracking program and a page that displays stats for various 
dates/items depending on what options the user selects. I need to add some 
kind of external reporting tool, i.e. they'd like to download the 
information, preferably in Excel.

I tried forcing Excel to open the data instead of the browser by sending 
headers:

  Header(Content-Type: application/vnd.ms-excel);
  Header(Content-Disposition: attachment; filename='stats.xls');

When I sent just the first one, all I got was a blank broswer page with a 
picture (application?) icon in the top left hand corner. Then I added the 
second header, which I found in a previous post in the archives, and that 
forced a download but of the page itself (stats_print.php).

1) What am I doing wrong?

2) Every posting I found in the archives said this is the easiest way. Is 
there another, harder but might work for me, way anyone would suggest of 
doing this?

Thanks in advance,

-Lisi


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Reporting tool for stats pulled from MySQL db

2003-02-25 Thread Lisi
In the first line, what do you mean where the file is? Where I want it to 
be? It doesn't exist yet, I want to generate an Excel file from dynamic 
data. And I don't want it to be saved on the server, I just want the user 
to download it.

Anyway, I tried changing

Header(Content-Disposition: attachment; filename='stats.xls');

to

Header(Content-Disposition: inline; filename='stats.xls');

without adding any of your other changes but I got the same icon in the 
corner. I'm using IE 6.

-Lisi

At 09:46 AM 2/25/03 +, George Pitcher wrote:
Lisi,

This is a modification of a script I use to download pdfs.

It might just work

?php
$fpd = E:\\MyFolder\\ . $fp . .xls; // where the file is
$len = filesize($fpd);
header(Content-Type: application/vnd.ms-excel);
header(Content-Disposition: inline; filename=$fpd);
header(Content-Title: $fpd);
header(Content-Length: $len);
readfile($fpd);
?
George

 -Original Message-
 From: Lisi [mailto:[EMAIL PROTECTED]
 Sent: 25 February 2003 9:41 am
 To: PHP-DB
 Subject: [PHP-DB] Reporting tool for stats pulled from MySQL db


 I have a stats tracking program and a page that displays stats
 for various
 dates/items depending on what options the user selects. I need to
 add some
 kind of external reporting tool, i.e. they'd like to download the
 information, preferably in Excel.

 I tried forcing Excel to open the data instead of the browser by sending
 headers:

   Header(Content-Type: application/vnd.ms-excel);
   Header(Content-Disposition: attachment; filename='stats.xls');

 When I sent just the first one, all I got was a blank broswer page with a
 picture (application?) icon in the top left hand corner. Then I added the
 second header, which I found in a previous post in the archives, and that
 forced a download but of the page itself (stats_print.php).

 1) What am I doing wrong?

 2) Every posting I found in the archives said this is the easiest way. Is
 there another, harder but might work for me, way anyone would suggest of
 doing this?

 Thanks in advance,

 -Lisi


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php