2
我無法修復我的代碼中出現問題。它導致一個數據。我需要的是循環並使用這些行從數據庫中獲取所有數據。PHPExcel如何使用codeigniter動態設置單元值
控制器
function firstDebit(){
$series=$this->uri->segment(3);
$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();
$query->row_array();
$rowNumber=10;
foreach($query->row_array() as $rows){
$this->excel->setCellValue('b'.$rowNumber, $rows);
$rowNumber++;
}
}
我用它開本,但它會產生一個錯誤。 甲PHP錯誤遇到 嚴重性:注意 消息:未定義偏移量:0 文件名:細胞/ DefaultValueBinder.php 行號:82 回溯: 文件:C:\ XAMPP \ htdocs中\ ACC \ application \ third_party \ PHPExcel \ Cell \ DefaultValueBinder.php 行:82 函數:_error_handler – Nexus
作爲使用結果數組的結果,您必須使用$ rows ['accountName']作爲單元格值。 – follio
它的作品!非常感謝Follio :) – Nexus