PHP/Oracle need code to Export a resulted query to Excel.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cforant
Forum Newbie
Posts: 4
Joined: Thu May 26, 2005 9:49 am

PHP/Oracle need code to Export a resulted query to Excel.

Post by cforant »

Currently we are displaying the result of an ORACLE query on a php page. We would like to export the results of that stored query to an excel spreadsheet with the touch of a button/link.

Anybody ever do this??? :?:
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

Code: Select all

<?php
header("Content-Type: application/vnd.ms-excel");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
?>
those headers should retun the output as a excell spreadsheet style then you can just catch all the data outputted and save it to a file i suppose, never done it but why wouldnt it work
cforant
Forum Newbie
Posts: 4
Joined: Thu May 26, 2005 9:49 am

help!!!!!!!

Post by cforant »

Is there anyone out there that knows how this works??? :o
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

You can get classes that will allow you to create excel spreadsheets. Look at PEAR for a decent one.

Usually, I just export as a comma separated file, then import it into Excel. As cool as making an Excel spreadsheet is, it's quite a bugbear to get working flawlessly (in my experience).
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

pickle wrote:You can get classes that will allow you to create excel spreadsheets. Look at PEAR for a decent one.

Usually, I just export as a comma separated file, then import it into Excel. As cool as making an Excel spreadsheet is, it's quite a bugbear to get working flawlessly (in my experience).
As said, there is alot of premade classes for this (why reinvent the wheel?). I've used BiffWriter briefly once, and it worked well.
cforant
Forum Newbie
Posts: 4
Joined: Thu May 26, 2005 9:49 am

Post by cforant »

I am not having any luck with these suggestions. I may be utilizing them incorrectly.

The situation again is...I already have a saved query displaying on a results page, I just want the php code to insert into my code that will allow me to export that query into a spreadsheet, cvs, xls, anything. Please help.
Post Reply