php - Before getting the records csv gets downloaded -


i'm working on php excel export. here i'm facing problems there huge number of data 8000 records. data placed in cell perfectly. issue

on 3000 records csv gets downloaded. how can fix ?

there no more 3000 8000 how can ?

example code

    <?php     // connection                   $tamdsreport_billing_qry = db_query($_session['tamdsreport_billing_qry']);                                 while($result_tamdsreport_billing_qry = db_fetch_array($tamdsreport_billing_qry)){                                    $datacenter_param = $result_tamdsreport_billing_qry['datacenter'];                                   $cid_param = $result_tamdsreport_billing_qry['cid'];                                   $rid_param = $result_tamdsreport_billing_qry['rid'];                                   $datastore_name_param = $result_tamdsreport_billing_qry['datastore_name'];                                   $cloud_type_param = $result_tamdsreport_billing_qry['cloud_type'];                                   $storage_type_param = $result_tamdsreport_billing_qry['storage_type'];                                   $avg_capacity_gb_param = $result_tamdsreport_billing_qry['avg_capacity_gb'];                                   $avg_free_space_gb_param = $result_tamdsreport_billing_qry['avg_free_space_gb'];                                   $avg_space_consumed_gb_param = $result_tamdsreport_billing_qry['avg_space_consumed_gb'];                                   $gb_used_param = $result_tamdsreport_billing_qry['gb_used'];                                   $start_date = $result_tamdsreport_billing_qry['start_date'];                                   $end_date = $result_tamdsreport_billing_qry['end_date'];                                    $html3[] = "<tr><td>$datacenter_param</td><td>$start_date</td><td>$end_date</td><td>$cid_param</td><td>$rid_param</td><td>$datastore_name_param</td><td>$cloud_type_param</td><td>$storage_type_param</td><td>$avg_capacity_gb_param</td><td>$avg_free_space_gb_param</td><td>$avg_space_consumed_gb_param</td><td>$gb_used_param</td></tr>";                          }            $html = "<table><tr><td>&nbsp;</td><tr><td><h3>storage usage a0ca </h3> </td></tr><tr bgcolor='#445fea'><td>data center</td><td>report start date</td><td>report end date</td><td>cid</td><td>rid</td><td>data store name</td><td>cloud type</td><td>storage type</td><td>avg capacity gb</td><td>avg free space gb</td><td>avg space consume gb</td><td>gb used</td></tr>".implode("\r\n", $html3). "</table>";           $filename = 'tamdrp_billing_export_us.xls';  } header('content-type: application/octet-stream'); header('content-transfer-encoding: binary'); header('expires: 0'); header('cache-control: must-revalidate, post-check=0, pre-check=0'); header('pragma: public'); header("content-disposition: attachment; filename=$filename"); echo $html; exit; ?> 

you have try phpexcel. wish worked you.

require_once 'phpexcel/classes/phpexcel.php'; $objphpex     = new phpexcel(); $filename     = 'output.xlsx'; $objworksheet = $objphpex->getactivesheet(0);  $objphpex->getactivesheet()->getcolumndimension('a')->setwidth(14);  $objphpex->getactivesheet()->setcellvalue('s1',123); $objwriter = phpexcel_iofactory::createwriter($objphpex, 'excel2007'); $objwriter->save('products_inventory_files/' . $filename); 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -