I have this code in my project
if($run_query == true){
        $i = 1;
        $query1 = "SELECT * FROM `scores` WHERE `subjects` = '{$result_subject}' AND `class` = '{$student_class}' AND `term` = '{$result_term}' AND `session` = '{$result_session}' ORDER BY `total` DESC ";
        $run_query1 = mysqli_query($connection, $query1);
        
            while($outputs = mysqli_fetch_assoc($run_query1)){
                
                $subject_t = $outputs['total'];
                
                
                $sql = "UPDATE score SET position = '{$i}' WHERE total = '{$subject_t}'";
                $run_query2 = mysqli_query($connection, $sql);
                $i++;
                
            }
The problem here is that the update query updates position column wit 1,2,3,4,5,6 etc and not observing dense ranking function. Please help

 
     
     
    