Untitled

 avatar
unknown
plain_text
3 years ago
1.7 kB
5
Indexable
<html>
    <head>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
        <link href="https://fonts.googleapis.com/css2?family=Fredoka+One&display=swap" rel="stylesheet">
        <style>
            body {
    font-family: Fredoka One;
}
.orange{
    color: #fff;
    background-color: #FF7B54;
      border-radius: 1em;

}

        </style>
    </head>
</html>

<?php
header('Access-Control-Allow-Origin: *');

include 'login.php';


// Connect to server and select database.
$con = mysqli_connect($host, $db_username, $db_password, $db_name);

// Retrieve data from database
$sql = "SELECT *
        FROM leaderboardlatto
        ORDER BY coins DESC
        LIMIT 100";	// The 'LIMIT 10' part will only read 10 scores. Feel free to change this value
$result = mysqli_query($con, $sql);

$no = 1;
?>

<table class="table table-striped">
  <thead>
    <tr class="orange">
      <th scope="col">Ranking</th>
      <th scope="col">Nama</th>
      <th scope="col">Score</th>
    </tr>
  </thead>
  <tbody>
    <?php
    // Iterasi setiap baris data dari hasil query
    while ($row = mysqli_fetch_array($result)) {
      // Tampilkan data dari masing-masing kolom
      echo "<tr>";
      echo "<td>" . $no . "</td>";
      echo "<td>" . $row['username'] . "</td>";
      echo "<td>" . $row['coins'] . "</td>";
      echo "</tr>";
      
      // Increment nomor urut
      $no++;
    }
    ?>
  </tbody>
</table>

<?php
// Tutup koneksi ke database
mysqli_close($conn);
?>



Editor is loading...