header('Access-Control-Allow-Origin: *');
$servername="myhost"; // Host name
$username="myuser"; // Mysql username
$password="mypass"; // Mysql password
$dbname="mydatabase"; // Database name
$tbl_name="mytable"; // Table name
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT user,score FROM starglass";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "" . $row["user"]. "|" . $row["score"]. "";
}
} else {
echo "0 results";
}
$conn->close();