<?php
$parameter = $_GET['parameter'];
$servername = "localhost";
$username = "hossan";
$password = 'k/oVEq4vLATIoY';
$dbname = "zhossan";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
//echo "Connected successfully";
$sql = "SELECT * FROM Scores ORDER BY Score DESC LIMIT 10";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row and put them into a json array
    while ($row = $result->fetch_assoc()) {
        //echo "Name: " . $row["Naam"]. " -Score:" . $row["Score"]. "-Datum:" . $row["Datum"]. "<br>";
        $data[] = $row;
        $json = json_encode($data);
    }
} else {
    echo "0 results";
}
echo $json;

