![]() |
counting total problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: counting total problem (/showthread.php?tid=49623) |
counting total problem - El Forum - 02-27-2012 [eluser]Bigil Michael[/eluser] code i used to calculate the count is given below Code: $count=0; i print the query and run on mysql Code: SELECT COUNT(rr.id) AS total FROM (`rooms_reservation` AS rr) JOIN `rooms` AS r ON `r`.`id` = `rr`.`rooms_id` WHERE `rr`.`status` = '1' GROUP BY `rr`.`category_id`, `rr`.`checkin_date`, `rr`.`checkout_date`, `rr`.`reservation_date`, `rr`.`name`, `rr`.`email`, `rr`.`num_rooms` result is like this total 1 1 2 2 2 2 . . . like this if i remove group by count prints correctly. but cant remove group by. can any one help me to solve this problem counting total problem - El Forum - 02-27-2012 [eluser]Bigil Michael[/eluser] can any one help me???? counting total problem - El Forum - 02-27-2012 [eluser]Bigil Michael[/eluser] any one know how to calculate the sum of these counts. counting total problem - El Forum - 02-27-2012 [eluser]InsiteFX[/eluser] Try: Code: $count = count($row->total); counting total problem - El Forum - 02-28-2012 [eluser]Bigil Michael[/eluser] thanks for yor reply. counting total problem - El Forum - 02-28-2012 [eluser]Bigil Michael[/eluser] solved my problem like this controller Code: $tot = $this->Reservations_model->get_enq_total(); model Code: function get_enq_total() |