From e9e66a0cd7325c60ecf2f566831fbe41aae22228 Mon Sep 17 00:00:00 2001 From: rootcoma Date: Thu, 14 Nov 2013 16:15:00 -0800 Subject: [PATCH] Updating links and queries --- php/stats.php | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/php/stats.php b/php/stats.php index 953a726..fc929ee 100644 --- a/php/stats.php +++ b/php/stats.php @@ -90,29 +90,6 @@
- - query('SELECT username, sum(points_made) as points FROM triviauserlog GROUP BY username_canonical 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

@@ -131,7 +108,7 @@ if ($db) { $q = $db->prepare("SELECT username, sum(points_made) as points FROM triviauserlog WHERE day=:day AND year=:year AND month=:month GROUP BY username_canonical ORDER BY points DESC LIMIT 10"); - $q->execute(array(':day'=>$day, 'year'=>$year, 'month'=>$month)); + $q->execute(array(':day'=>$day, ':year'=>$year, ':month'=>$month)); if ($q === false) { die("Error: database error: table does not exist\n"); } else { @@ -227,7 +204,7 @@ if ($db) { $q = $db->prepare("SELECT username, sum(points_made) as points FROM triviauserlog WHERE year=:year AND month=:month GROUP BY username_canonical ORDER BY points DESC LIMIT 10"); - $q->execute(array('year'=>$year, 'month'=>$month)); + $q->execute(array(':year'=>$year, ':month'=>$month)); if ($q === false) { die("Error: database error: table does not exist\n"); } else { @@ -268,7 +245,7 @@ if ($db) { $q = $db->prepare("SELECT username, sum(points_made) as points FROM triviauserlog WHERE year=:year GROUP BY username_canonical ORDER BY points DESC LIMIT 10"); - $q->execute(array('year'=>$year)); + $q->execute(array(':year'=>$year)); if ($q === false) { die("Error: database error: table does not exist\n"); } else { @@ -292,7 +269,7 @@