Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14115

count_all_results returns 1 every time in 3.0.6

$
0
0
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();;

Viewing all articles
Browse latest Browse all 14115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>