• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
query problem

#1
here is my model


PHP Code:
function get($where = [],$like = [],$order '',$group_by = [],$type 'array'){
 
       $this->db->select('*');
 
       $this->db->from($this->table);
 
       if(!empty($where))
 
           $this->db->where($where);
 
       if(!empty($like))
 
           $this->db->like($like);
 
       if(!empty($order))
 
           $this->db->order_by($order);
 
       if(!empty($group_by))
 
           $this->db->group_by($group_by);
 
       $this->db->join('fb_cities''fb_cities.id_ci = fb_usr.id_ci''left');
 
       $this->db->join('fb_classes''fb_classes.id_cl = fb_usr.id_cl''left');
 
       $this->db->join('fb_person''fb_person.id_pe = fb_usr.id_pe''left');
 
       $this->db->join('fb_posts''fb_posts.id_po = fb_usr.id_po''left');
 
       $this->db->join('fb_schools''fb_schools.id_sc = fb_usr.id_sc''left');
 
       $this->db->join('fb_key''fb_key.id_fb_us = fb_usr.id_fb_us''left');
 
       $query $this->db->get();
 
       if($type == 'array')
 
           return $query->result_array();
 
       else
            return $query
->row();
 
   

here is my challenge in the controller


PHP Code:
$this->M_usr->get(['fb_usr.id_sc' => $this->input->post('school_id'),'fb_usr.id_cl !=' => 0,'fb_usr.id_sc !=' => ''], [], 'fb_classes.name_cl ASC', ['fb_usr.id_cl']); 

here's the error

Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'admin_codeignite.fb_usr.id_fb_us' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

SELECT `fb_usr`.`id_fb_us` as `id_fb_us`, `fb_usr`.`fname` as `fname`, `fb_usr`.`lname` as `lname`, `fb_usr`.`sname` as `sname`, `fb_usr`.`fio` as `fio`, `fb_usr`.`email` as `email`, `fb_usr`.`phone` as `phone` FROM `fb_usr` LEFT JOIN `fb_cities` ON `fb_cities`.`id_ci` = `fb_usr`.`id_ci` LEFT JOIN `fb_classes` ON `fb_classes`.`id_cl` = `fb_usr`.`id_cl` LEFT JOIN `fb_person` ON `fb_person`.`id_pe` = `fb_usr`.`id_pe` LEFT JOIN `fb_posts` ON `fb_posts`.`id_po` = `fb_usr`.`id_po` LEFT JOIN `fb_schools` ON `fb_schools`.`id_sc` = `fb_usr`.`id_sc` LEFT JOIN `fb_key` ON `fb_key`.`id_fb_us` = `fb_usr`.`id_fb_us` WHERE `fb_usr`.`id_sc` = '18' AND `fb_usr`.`id_cl` != 0 AND `fb_usr`.`id_sc` != '' GROUP BY `fb_usr`.`id_cl` ORDER BY `fb_classes`.`name_cl` ASC


Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
query problem - by midav - 07-02-2019, 03:05 AM
RE: query problem - by hc-innov - 07-02-2019, 05:37 AM
RE: query problem - by midav - 07-02-2019, 07:12 AM
RE: query problem - by php_rocs - 07-02-2019, 08:01 AM
RE: query problem - by midav - 07-02-2019, 08:22 AM
RE: query problem - by php_rocs - 07-02-2019, 10:04 AM
RE: query problem - by midav - 07-04-2019, 05:48 AM
RE: query problem - by midav - 07-04-2019, 05:52 AM
RE: query problem - by hc-innov - 07-04-2019, 08:59 AM
RE: query problem - by neuron - 07-04-2019, 08:20 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.