【发布时间】:2019-12-29 14:06:53
【问题描述】:
访问页面时发生错误并显示在页面上。显示的错误如下所述:
An uncaught Exception was encountered
Type: Error
Message: Call to a member function num_rows() on bool
Filename: localhost/app/models/admin/Reports_model.php
错误中引用的方法是这样的:
public function getTotalReturnSales($start, $end, $warehouse_id = null)
{
$this->db->select('count(id) as total, sum(COALESCE(grand_total, 0)) as total_amount, SUM(COALESCE(paid, 0)) as paid, SUM(COALESCE(total_tax, 0)) as tax', false)
->where('date BETWEEN ' . $start . ' and ' . $end);
if ($warehouse_id) {
$this->db->where('warehouse_id', $warehouse_id);
}
$q = $this->db->get('returns');
if ($q->num_rows() > 0) {
return $q->row();
}
return false;
}
这个错误是怎么引起的?
【问题讨论】:
标签: php mysql codeigniter model codeigniter-3