如何使用PhpExcel和Codeigniter在单元格中循环数据

时间:2016-09-06 06:49:23

标签: php mysql codeigniter phpexcel-1.8.0

它仅显示单个单元格中的一个数据。但我想要的是循环它以显示我的数据库中的所有数据

这是我的控制器代码。

function firstDebit(){
$series=$this->uri->segment(3); 
$this->jevReport_model->getfirstDebit($series);
$data['accountNames']=$this->jevReport_model->getfirstDebit($series);
$accountName=$data['accountNames']['accountName'];

$this->excel->setCellValue('b10',$accountName);

}

模型

function getfirstDebit($series) {
$this->db->select ( 'accountcode.accountName' );
$this->db->from ( 'accountcode' );
$this->db->join ( 'generalaccount ', 'generalaccount.AccountCode = accountcode.id');
$this->db->where ( 'generalaccount.Series', $series);
$this->db->where ( 'generalaccount.Account', 'debit');
$this->db->where ( 'generalaccount.Count', 1);
$query = $this->db->get();
return $query->row_array ();

}

这是我的代码的输出 enter image description here

但我想要的是这样的

enter image description here

我真的需要帮助。谢谢。

0 个答案:

没有答案