feat: solve real rank

This commit is contained in:
Matthew Florentino 2025-12-02 12:09:16 +07:00
parent b5672b2326
commit 25874a4643

View File

@ -1,4 +1,4 @@
<?php
<?php
session_start();
require_once "config/db.php";
@ -17,6 +17,10 @@ if ($result_me && mysqli_num_rows($result_me)>0){
$score = $row['score'];
}
$queryrank = "SELECT COUNT(*) as ranking FROM users WHERE score > $score";
$resultrank = mysqli_query($db, $queryrank);
$rowrank = mysqli_fetch_assoc($resultrank);
$realrank = $rowrank['ranking']+1;
$result = mysqli_query($db, $sql);
$leaderboard = [];
@ -87,7 +91,7 @@ if($result){
<table>
<tbody>
<tr>
<td><?php echo $peringkat; ?></td>
<td><?php echo $realrank; ?></td>
<td><?php echo $nama; ?></td>
<td><?php echo $pemain['score']; ?> PTS</td>