Print out sql on php page in order of scores
This commit is contained in:
22
server/getData.php
Normal file
22
server/getData.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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
|
||||
while($row = $result->fetch_assoc()) {
|
||||
echo "Name: " . $row["Naam"]. " -Score:" . $row["Score"]. "-Datum:" . $row["Datum"]. "<br>";
|
||||
}
|
||||
// $myJson = json_encode($result);
|
||||
// echo $myJson;
|
||||
}
|
Reference in New Issue
Block a user