'Ascending order in controller

enter image description here

In this picture, we can see the "cockNoM" has been displayed. But the problem is they are not in order. My target is to display them in order 1, 2, 3, 4, 5, 6. Any help will be appreciated. Thank you so much

Controller:

function asdasdas(){
            $entry= $this->repo->entryfetch();
            
            
            
            $data='<table>
    <thead><tr><th>NO. ENTRY NAME</th><th>WB</th><th>LB</th><th>WT</th><th>NO #</th><th>ENTRY NAME</th><th>WB</th><th>LB</th><th>WT</th><th>Diff</th></tr></thead>';
          
            
            foreach($entry as $entry){
                
                $match= $this->repo->matchfetch($entry->handlerID);
                
                $data.='<thead><tr><th><hr>'.$entry->handlerID.'&nbsp;'.$entry->entryName.'</th> ';
     
             
                
                foreach($match as $match){
                    
                    $diff = $match->weightM - $match->weightW;
                    
                    if($match->handlerIDM === $entry->handlerID){
                        $name=$match->handlertestW;
                        $cock=$match->cockNoM;
                    }else{
                        
                        $name=$match->handlerM;
                        $cock=$match->cockNoW;
                    }
                    
                    
                    
                    $data.='<tbody><tr><td>'.$cock.'</td><td>'.$match->wingBandM.'</td><td>'.$match->legBandM.'</td><td>'.$match->weightM.'</td><td>'.$match->handlerIDW.'</td><td>'.$name.'</td><td>'.$match->wingBandW.'</td><td>'.$match->legBandW.'</td><td>'.$match->weightW.'</td><td>'.$diff.'</td>';
               
                    $data.='<td></td></tr></tbody>';
    //             
                }
               
                
            }
            
            $data .='<table>';
          
            echo $data;
            
        }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source