Wiki

Clone wiki

BukkitGames / Creating a stats webpage

Intro

So you want to make a webpage displaying all the stats from your database? Well, if you don't know PHP or SQL then you might want to take a look at our website template. If you can code you might want to take a look below.

Useful SQL queries

Here are some SQL statements you can use to get some basic stats from your database.

Top10 Winners

#!sql

SELECT bg_players.NAME, COUNT(DEATH_REASON) AS WINS FROM bg_plays JOIN bg_players on bg_plays.REF_PLAYER = bg_players.ID WHERE bg_plays.DEATH_REASON = "WINNER" AND bg_players.NAME IS NOT NULL GROUP BY REF_PLAYER ORDER BY WINS DESC LIMIT 10;

Top10 Killers

#!sql

SELECT bg_players.NAME, COUNT(REF_KILLER) AS KILLS FROM bg_plays JOIN bg_players on bg_plays.REF_KILLER = bg_players.ID WHERE bg_plays.DEATH_REASON != "WINNER" AND bg_plays.REF_KILLER != 0 AND bg_players.NAME IS NOT NULL GROUP BY REF_KILLER ORDER BY KILLS DESC LIMIT 10;

Top10 Deaths

#!sql
SELECT bg_players.NAME, COUNT(DEATH_REASON) AS DEATHS FROM bg_plays JOIN bg_players on bg_plays.REF_PLAYER = bg_players.ID WHERE bg_plays.DEATH_REASON != "WINNER" AND bg_plays.DEATH_REASON != "CRASH" AND bg_players.NAME IS NOT NULL GROUP BY REF_PLAYER ORDER BY DEATHS DESC LIMIT 10;

###See complete table structure###

Want to display stats about the current game on your website? Check out the BukkitGames web API.

Updated