![]() |
Please help, Iarray sort not working - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Please help, Iarray sort not working (/showthread.php?tid=74152) |
Please help, Iarray sort not working - soapz - 08-03-2019 Hello. Please somebody help..I want to arrange the foreach loop according to the highest number of average exam score. I used rsort or sort array but it returns zero. see my code: <?php $this->db->where('class_id' , $class_id); $this->db->where('year' , $running_year); $this->db->from('subject'); $number_of_subjects = $this->db->count_all_results(); $average_score= ($total_marks / $number_of_subjects); rsort($average_score); echo(round($average_score,2)); ?> after i get the highest average score i want to rank it as 1st,2nd, 3rd.... Kindly help RE: Please help, Iarray sort not working - PaulD - 08-04-2019 rsort requires an array. You appear to be trying to sort a single variable. https://www.php.net/manual/en/function.rsort.php |