Welcome Guest, Not a member yet? Register   Sign In
count_all_results returns 1 every time in 3.0.6
#1

I have the following code to get results from a mySQL database. Every time I run the code, the result is 1. If I run a get() on the code, 3 rows are returned.

$this->db->select('Customer.obj_id as customerObjId,
Customer.last_name as lastName,
Customer.first_name as firstName,
concat_ws(", ", Address.address1, Address.city, Address.state, Address.zip) as defaultAddress,
Phone.phone as defaultPhone,
Email.email as defaultEmail,
sum(Rewards.points_earned) as pointsEarned,
sum(Rewards.points_redeemed) as pointsRedeemed')
->from('Customer')
->join('Address', 'Address.customer_obj_id = Customer.obj_id and Address.default_address = 1', 'left outer')
->join('Rewards', 'Rewards.customer_obj_id = Customer.obj_id', 'left outer');

$this->db->join('Phone', 'Phone.customer_obj_id = Customer.obj_id and Phone.default_phone = 1', 'left outer');

$this->db->join('Email', 'Email.customer_obj_id = Customer.obj_id and Email.default_email = 1', 'left outer');

$this->db->like('upper(Customer.last_name)', 'A');

$this->db->group_by('Customer.obj_id');
return $this->db->count_all_results();;
Reply


Messages In This Thread
count_all_results returns 1 every time in 3.0.6 - by crouchkl - 06-08-2017, 10:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB