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!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am a beginner and i am not very good at this. can someone please tell how to output php result to excel. here is my code. this works and shows result, i just dont have the button and the code to output the result to excel. Help please
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
i checked pear, but could not find the answer here is something i found using google.
$filename = "some_crap.xls";
//take care of all the excel initialization
$header_temp = "Content-Disposition: attachment; filename=$filename";
header("Content-type: application/octet-stream");
header($header_temp);
header("Pragma: no-cache");
header("Expires: 0");
it said to paste this to my code but i'm not really sure how to use this and im also not sure how to code the button to make it export the files to excel. can someone please show me.
ugh...i just dont get this stuff. i dont know how to use this to make it work for my code. sorry guys PHP is really hard for me to learn. You guys have probably given me the answer i needed to know but im just not getting it. do i need more than 1 page in order to make this work???
this is the code from pear: this is suppose to export my results to excel.
jpaloyo wrote:ugh...i just dont get this stuff. i dont know how to use this to make it work for my code. sorry guys PHP is really hard for me to learn. You guys have probably given me the answer i needed to know but im just not getting it. do i need more than 1 page in order to make this work???
this is the code from pear: this is suppose to export my results to excel.
tags when [url=http://forums.devnetwork.net/viewtopic.php?t=21171]posting code in the forum[/url].[/size][/quote]
This snippet works perfect for me. It shows me the saveAs dialog in the browser.
Using FF 1.5.0.1
PHP 5.1.2 I am sure it works with >=4.3.8 as well
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
weird this does not work for me. it show a white page. I double checked to make the tag in all closed and i made sure of the semi colons but its all there. I am using PHP designer 2005 and mysql database. will this code not work for me? this block of code is php from what i can tell. The "require_once" line, is that a class? and if so whats the code behind it to make this block of code work?
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
weird this does not work for me. it show a white page. I double checked to make the tag in all closed and i made sure of the semi colons but its all there. I am using PHP designer 2005 and mysql database. will this code not work for me? this block of code is php from what i can tell. The "require_once" line, is that a class? and if so whats the code behind it to make this block of code work?
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color][/quote]
By your answer I understand you have no idea what PEAR is (although you said you "checked" it).
You need [url=http://pear.php.net/package/Spreadsheet_Excel_Writer]this[/url] package installed in your [url=http://pear.php.net]PEAR[/url]
Make sure it is in your include path. It should be if installed properly (another topic).
Then turn on error_reporting(E_ALL), display_errors and copy/paste the code snippet - simplify the problem.
And if you have problems then...have us know.
Happy coding.