Welcome Guest, Not a member yet? Register   Sign In
Get position (rank) based on subject score

I have a working function in my model where I'm trying to get the position of students in a class-based 
on their subject scores.
The problem is that the where clause isn't filtering results to classify them based on subjects.
please help me solve this

PHP Code:
public function GetSubjectPosScores($exam_group_class_batch_exam_subject_id
        return $this->db->get('exam_group_exam_results')->result(); 

PHP Code:
public function GetSubjectPosScores($exam_group_class_batch_exam_subject_id)
        $data $this->examresult_model->GetSubjectPosScores($exam_group_class_batch_exam_subject_id); 
        return $data;

PHP Code:
<td style="border: 1px solid black; font-size:15px;font-weight:bold;width:40px;text-align:center;color:black;"> <?php
$CI->GetSubjectPosScores($exam_result_value->exam_group_class_batch_exam_subject_id); //echo $value->pos;
                            $scores array_column($scores2'get_tot_score');
                            $pos array_search($exam_result_value->get_tot_score$scores);

                                                $number $pos 1;
                                  echo $CI->ordinal($number);


thank you. 

Move your order_by below your where order_by should be the last statement before retrieving the record with get.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Theme © iAndrew 2016 - Forum software by © MyBB