• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please help, Iarray sort not working

#1
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
Reply

#2
rsort requires an array. You appear to be trying to sort a single variable. https://www.php.net/manual/en/function.rsort.php
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.