/ Published in: PHP
Basic usage for PHPExcel with an mysql_fetch_array
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $objPHPExcel = new PHPExcel(); $objPHPExcel->setActiveSheetIndex(0); $rowCount = 1; $objPHPExcel->getActiveSheet()->SetCellValue('A'.$rowCount, $row['name']); $objPHPExcel->getActiveSheet()->SetCellValue('B'.$rowCount, $row['age']); $rowCount++; } $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel); $objWriter->save('some_excel_file.xlsx'); ?>