TriviaTime

Stats

Stats are updated continuously and instantly.

query('SELECT username, sum(points_made) as points FROM triviauserlog GROUP BY username ORDER BY points DESC LIMIT 10'); if ($q === false) { die("Error: database error: table does not exist\n"); } else { $result = $q->fetchAll(); foreach($result as $key=>$res) { echo ''; echo '' . ($key+1) . ''; echo '' . $res['username'] . ''; echo '' . $res['points'] . ''; echo ''; } } } else { die($err); } */ ?>

Todays Top Scores

prepare("SELECT username, sum(points_made) as points FROM triviauserlog WHERE day=:day AND year=:year AND month=:month GROUP BY username ORDER BY points DESC LIMIT 10"); $q->execute(array(':day'=>$day, 'year'=>$year, 'month'=>$month)); if ($q === false) { die("Error: database error: table does not exist\n"); } else { $result = $q->fetchAll(); foreach($result as $key=>$res) { echo ''; echo ''; echo ''; echo ''; echo ''; } } } else { die($err); } ?>
# Username Points
' . ($key+1) . '' . $res['username'] . '' . $res['points'] . '
sub($interval); $interval = new DateInterval('P1D'); for($i=0;$i<7;$i++) { if($i>0) { $sqlClause .= ' or '; } $sqlClause .= '(day=' . $week->format('j') . ' and month=' . $week->format('n') . ' and year=' . $week->format('Y') . ')'; $week->add($interval); } ?>

Week Top Scores

query("SELECT username, sum(points_made) as points FROM triviauserlog WHERE $sqlClause GROUP BY username ORDER BY points DESC LIMIT 10"); if ($q === false) { die("Error: database error: table does not exist\n"); } else { $result = $q->fetchAll(); foreach($result as $key=>$res) { echo ''; echo ''; echo ''; echo ''; echo ''; } } } else { die($err); } ?>
# Username Points
' . ($key+1) . '' . $res['username'] . '' . $res['points'] . '

Month Top Scores

prepare("SELECT username, sum(points_made) as points FROM triviauserlog WHERE year=:year AND month=:month GROUP BY username ORDER BY points DESC LIMIT 10"); $q->execute(array('year'=>$year, 'month'=>$month)); if ($q === false) { die("Error: database error: table does not exist\n"); } else { $result = $q->fetchAll(); foreach($result as $key=>$res) { echo ''; echo ''; echo ''; echo ''; echo ''; } } } else { die($err); } ?>
# Username Points
' . ($key+1) . '' . $res['username'] . '' . $res['points'] . '

Year Top Scores

prepare("SELECT username, sum(points_made) as points FROM triviauserlog WHERE year=:year GROUP BY username ORDER BY points DESC LIMIT 10"); $q->execute(array('year'=>$year)); if ($q === false) { die("Error: database error: table does not exist\n"); } else { $result = $q->fetchAll(); foreach($result as $key=>$res) { echo ''; echo ''; echo ''; echo ''; echo ''; } } } else { die($err); } ?>
# Username Points
' . ($key+1) . '' . $res['username'] . '' . $res['points'] . '