db->select('*'); $this->db->from('users'); $this->db->where('business_id', $business_id); $this->db->order_by('id','DESC'); // $this->db->where('role', 'user'); // $this->db->where('role', 'user'); // $this->db->where('is_active', 1); $query = $this->db->get(); $query = $query->result(); return $query; } public function get_admin() { $this->db->select('*'); $this->db->from('users'); $this->db->where('role !=', 'sadmin'); // $this->db->order_by('id','ASC'); $query = $this->db->get(); $query = $query->result(); return $query; } public function get_user_by_md5_id($id,$business_id) { $this->db->select('*'); $this->db->from('users'); $this->db->where('business_id', $business_id); $this->db->where('md5(id)', $id); $query = $this->db->get(); $query = $query->row(); return $query; } public function delete_user_by_md5_id($id,$business_id) { $this->db->where('md5(id)', $id); $this->db->where('business_id', $business_id); $this->db->set('is_active',0); $this->db->update('users'); return; } public function activate_inactive_users($id,$business_id) { $this->db->where('md5(id)', $id); $this->db->where('business_id', $business_id); $this->db->set('is_active',1); $this->db->update('users'); return; } public function business() { $this->db->select('*'); $this->db->from('business'); $query = $this->db->get(); $query = $query->result(); return $query; } public function get_business_by_md5_id($business_id) { $this->db->select('B.* , state.name as state_name '); $this->db->from('business B'); $this->db->join('state', 'state.id = B.state', 'left'); $this->db->where('B.is_active', 1); $this->db->where('md5(uid)', $business_id); $query = $this->db->get(); $query = $query->row(); return $query; } }