I want to get num_rows of query but i need to get it from result_array not from query. So, i call function array_sum to calculate num_rows but it doesnt work
I've tried to using array_sum (php function) but it return 0, it supposed to return 3
ListModel.php
Class ListModel extends CI_Model {
public function getList($id=null){
$listm = $this->db->query("
SELECT * FROM m_list m
LEFT JOIN list_country lc ON lc.id=m.id_country
WHERE lc.id_section = $id"
)->result_array();
return $listm;
}
}
MController.php
$arr_m= $this->ListModel->getList(15);
$return['total'] = array_sum($arr_m);
any idea to solved it?