0

I'm creating a project using codeigniter, all modules works fine in localhost, but when I uploaded the files on AWS, it's showing errors, mainly the group_by() is not working, if I'm removing this function, it works fine, please help, I've added some code snippet and the table structure.

model:

 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();
}

controller:

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

table structure: enter image description here

Error: enter image description here

Rohit Sahu
  • 284
  • 5
  • 15
  • 1
    Please provide CodeIgnitor's version, also please provide some db records as it may be possible that mysql's group by rules / constraints fail. See https://stackoverflow.com/questions/34115174/error-related-to-only-full-group-by-when-executing-a-query-in-mysql – Umair Khan Aug 17 '20 at 07:43

2 Answers2

0

Try this one

 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();
}

Armnature
  • 9
  • 5
0

After surveying, I found that there's an error coming out from the mysql while executing the query manually. enter image description here

so I removed only_full_group_by globally by executing this line in the SQL Server

SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
Rohit Sahu
  • 284
  • 5
  • 15