help me: how to export the form to the excel format???
Posted: Thu Oct 26, 2006 8:13 pm
Now i had generated a report, but i want to export as excel format.
Anyone can teach me?
thanks
Anyone can teach me?
thanks
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
$reportName="report";
$filetype="csv";
$varInput="....whatever value u want to pass in..";
$ip = $_SERVER['SERVER_NAME'];
header("Content-type: application/octet-stream");
header("Pragma: public");
header("Content-disposition: attachment; filename=".$ip."_".$reportName."_".date("Ymd").".".$filetype);
header("Cache-Control: post-check=0, pre-check=0, max-age=0");
header("Expires: 0");
$current_datetime = date("F j, Y, g:i a");
...some function to call your report query
print "\n";
print $head."\n".$data;Code: Select all
$reportName="report";
$filetype="csv";
$varInput="....whatever value u want to pass in..";
$ip = $_SERVER['SERVER_NAME'];
header("Content-type: application/octet-stream");
header("Pragma: public");
header("Content-disposition: attachment; filename=".$ip."_".$reportName."_".date("Ymd").".".$filetype);
header("Cache-Control: post-check=0, pre-check=0, max-age=0");
header("Expires: 0");
$current_datetime = date("F j, Y, g:i a");
$this->get_query(...variable to pass in...);
print $head."\n".$data;
function get_query(...variable to pass in....)
{
....sql scripts goes here
}You call the queries you need first, the assign the result into a var/array, then assign the var/array into the output of the Excel writer.cloud_0085 wrote:urgh...
how to call query from the function??