Show data from database (Export form) with phpoffice/spreadsheet MVC framework - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Wednesday, June 9, 2021

Show data from database (Export form) with phpoffice/spreadsheet MVC framework

I want to export data from database with phpoffice/spreadsheet but the looping didn't work. I use MVC framework.

my controller

$data['trx_registration'] = $this->m_regreport->get_report_reg1($loc); //       
$this->template->set('title', 'Kyoai | Registration Report');
$this->template->load('template', 'menu/reg_reportnew', $data);

my view

$sheet->setCellValue('A7', 'No');
$sheet->setCellValue('B7', 'ID Registration');
$sheet->setCellValue('C7', 'Patient Name');
$sheet->setCellValue('D7', 'Birthdate');
$sheet->setCellValue('E7', 'Company Name');
$sheet->setCellValue('F7', 'Type');

$s1 =  1;
$start =  8;
foreach ($trx_registration as $cius) {
    $sheet->setCellValue('A' . $start, $s1);
    $sheet->setCellValue('A' . $start, $cius->id_reg);

    $start = $start + 1;
    $s1 = $s1 + 1;
}


source https://stackoverflow.com/questions/67887959/show-data-from-database-export-form-with-phpoffice-spreadsheet-mvc-framework

No comments:

Post a Comment