mercredi 27 mars 2019

I wan to check that is my sql command containing the inputted data or not

I have two rounds "first and knock-out".Only the 4 team can go to knock-out round if they got the highest point on first round. Now firstly, I want to select that 4 team from first round and then check whether the inputted team is on the selected 4 team or not. Take a look to my code(So far i tried)

$matches= new Match();
     $matches->team1 = $request->input('team1');
     $matches->team2 = $request->input('team2');

$ko =  DB::select('SELECT * FROM points WHERE round="first" ORDER BY points DESC , run_rate DESC LIMIT 4');

if($ko == $matches->team1 || $team == $matches->team2) {

    $matches->round = "ko";
}
else{
   $matches->round = "first";   
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire