From af2f46761685f7be00c0ba7a7e9c83dd7eb445ae Mon Sep 17 00:00:00 2001 From: adplantade Date: Mon, 10 Aug 2020 18:46:41 +0200 Subject: [PATCH] score s'affiche entre "consulter" et "jouer" --- code/highscores.php | 75 ++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 39 deletions(-) diff --git a/code/highscores.php b/code/highscores.php index aed4cf7..21da23a 100644 --- a/code/highscores.php +++ b/code/highscores.php @@ -88,54 +88,51 @@ - -
- - - -
- query($sql); - $a=$result->fetchArray(); - - if($a==false) - { - $phrase= "Il n'y a pas encore de score pour ce mode de jeu."; - } - else - { - $phrase="Le record est ".$a[0].", tenu par ".$a["player"]; - while ($row = $result->fetchArray()) { - $phrase=$phrase.", ".$row["player"]; - } - + $sql='select score, player from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].' and score=(select max(score) from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].')'; } + else + { + $sql='select score, player from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].' and score=(select min(score) from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].')'; + } + $result = $database->query($sql); + $a=$result->fetchArray(); - echo "

".$phrase."

"; - echo ""; - echo ""; - echo ""; - echo ""; + if($a==false) + { + $phrase= "Il n'y a pas encore de score pour ce mode de jeu."; } - ?> + else + { + $phrase="Le record est ".$a[0].", tenu par ".$a["player"]; + while ($row = $result->fetchArray()) { + $phrase=$phrase.", ".$row["player"]; + } + +} + + echo "

".$phrase."

"; + echo ""; + echo ""; + echo ""; + echo ""; +} +?> +
+ + +
+ +