// Open MySQL connection $mysqli = new mysqli("localhost", "pinball", "demoscene", "pinball"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: " . $mysqli->connect_error; die; } $CURRENT_VERSION = "1.0.1"; // Query highscore table $version = explode('.', $CURRENT_VERSION); //$statement = $mysqli->prepare("SELECT name, score, submit_time FROM highscores WHERE submitted=1 AND version_major=? AND version_minor=? ORDER BY score DESC LIMIT 50"); //$statement = $mysqli->prepare("SELECT name, MAX(score) as score, submit_time FROM highscores WHERE submitted=1 AND version_major=? AND version_minor=? GROUP BY name ORDER BY score DESC"); $statement = $mysqli->prepare("SELECT h1.name, h1.score, h1.submit_time FROM highscores h1 INNER JOIN (SELECT name, MAX(score) score FROM highscores WHERE submitted=1 AND version_major=? AND version_minor=? GROUP BY name) h2 ON h1.name = h2.name AND h1.score = h2.score ORDER BY h1.score DESC"); $statement->bind_param('ii', $version[0], $version[1]); function writeTable($statement) { echo("
Position | \n"); echo("Name | \n"); echo("Score | \n"); echo("Date | \n"); echo("
---|---|---|---|
" . $position . ". | \n"); echo("" . $name . " | \n"); echo("" . $formattedScore . " | \n"); echo("" . $formattedDate . " | \n"); echo("
This page is still under construction.
This page was last modified on echo date ("j.n.Y",getLastMod());?>