Posted by Mike G. on 07/19/06 00:39
You're on the right track.
You'll need to have an export script that will send the appropriate
header to tell the browser to download the document rather than to
display it. This is exemplified on the header function's page
(http://www.php.net/header).
I would start with something simple: CSV. It's nothing more than a set
of data separated by commas. The only headache would be if your data
could potentially contain commas (say a "description" field). Then an
escaping routine will need to be planned.
Cheers,
Mike G.
toffee wrote:
> Hi all,
>
> i have a simple php script which pulls data from mysql db and displays it. i
> would like to add the option to export the displayed table to an excel
> spreadsheet with the click of a button.
> i've done some googling and it seems the best way is to call onclick a
> seperate php file with the excel header which will then prompt user to save
> file.
> since am n00b, i appreciate its a bit longwinded so my question is: is there
> a better and efficient way since the data has already been retrieved; why go
> again an retrieve it ?
>
> all suggestions are appreciated
Navigation:
[Reply to this message]
|