在添加 group_by() codeigniter 时调用布尔值的成员函数 result()

Call to a member function result() on boolean while adding group_by() codeigniter

我正在使用 codeigniter 创建一个项目,所有模块在本地主机上工作正常,但是当我将文件上传到 AWS 时,它显示错误,主要是 group_by() 不工作,如果我正在删除这个函数,它工作正常,请帮忙,我添加了一些代码片段和 table 结构。

型号:

 public function getPendingPayments() {
    $this->db->where('is_paid', 0);
    $this->db->where('is_installment', 0);
    $this->db->group_by('party'); // here if I remove this line, everything works fine
    $this->db->order_by('bill_date', 'asc');
    return $this->db->get('bills')->result();
}

控制器:

$data['UNPAID_CLIENTS'] = $this->Payments_model->getPendingPayments();

table结构:

错误:

试试这个

 public function getPendingPayments() {
    $this->db->where('is_paid', 0);
    $this->db->where('is_installment', 0);
    $this->db->group_by('party'); 
    $this->db->order_by('bill_date', 'asc');

if($this->db->num_rows() < 1){
return false;
}else{
   return $this->db->get('bills')->result();

    return $this->db->get('bills')->result();
}

经过调查,我发现手动执行查询时 mysql 出现错误。

所以我通过在 SQL 服务器

中执行这一行来全局删除 only_full_group_by
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));