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
| # |
Username |
Points |
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 '| ' . ($key+1) . ' | ';
echo '' . $res['username'] . ' | ';
echo '' . $res['points'] . ' | ';
echo '
';
}
}
} else {
die($err);
}
?>