Hi,
I am able to get the data from database file displayed on to the screen. How to send this data to a output file in Microsoft Excel format. What function should i be using.
I am using the below give function in "projectwise_report_model"
function toolbar_list()
{
$query = $this->db->query("select pap_tblpayments.vPProjName as projectname, pap_tblprojectname.nProjCost as projectcost ,pap_tblprojectname.dProjStartdate as projstartdt, pap_tblprojectname.dProjEnddate as projenddate, pap_tblpayments.vPRate as labour350 From pap_tblprojectname LEFT JOIN pap_tblpayments ON pap_tblpayments.vPRate WHERE pap_tblpayments.vPRate='350' ");
$arr='';
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
$arr[] =$row;
}
}
return $arr;
}
------
OUTPUT displayed on the screen
Projectwise Report
Project Name Project Cost Start date End date Labour
@350/dayDaddy builders 25000 2013-11-05 2013-12-20 350
Daddy builders 50000 2014-01-01 2014-01-30 350
Daddy builders 30000 2014-02-11 0000-00-00 350
Daddy builders 25000 2013-11-05 2013-12-20 350
Daddy builders 50000 2014-01-01 2014-01-30 350
Daddy builders 30000 2014-02-11 0000-00-00 350
Fransua Mansion 25000 2013-11-05 2013-12-20 350
Fransua Mansion 50000 2014-01-01 2014-01-30 350
Fransua Mansion 30000 2014-02-11 0000-00-00 350
-----------
Need help to send the above data (report) to a output file in Excel format.
Thanks
Comments
If you are doing it outside of the module, CodeIgniter has a "force_download($filename, $data);" function you can use found in the download helper you can try using:
https://ellislab.com/codeigniter/user-guide/helpers/download_helper.html