summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2008-07-16 17:20:18 -0700
committerArun Persaud <arun@nubati.net>2008-07-16 17:20:18 -0700
commit246c48b885be01d7d6eb63167b6d346cd314120d (patch)
tree89aa780a265aac55e2ed1e1137265ce5d6f4fffd
parentdb82830ad5268aedd807536be2486de22b989ae0 (diff)
downloade-DoKo-246c48b885be01d7d6eb63167b6d346cd314120d.tar.gz
e-DoKo-246c48b885be01d7d6eb63167b6d346cd314120d.tar.bz2
e-DoKo-246c48b885be01d7d6eb63167b6d346cd314120d.zip
BUGFIX: wrong DB query returned sometime less rows than expected
this fixes a bug on the home page where, in case no game was in the pre-game phase, the ongoing games were listed as games being started and the completed games were listed as ongoing games. Signed-off-by: Arun Persaud <arun@nubati.net>
-rw-r--r--include/welcome.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/welcome.php b/include/welcome.php
index 5436ecf..654e968 100644
--- a/include/welcome.php
+++ b/include/welcome.php
@@ -9,12 +9,15 @@ if(!isset($HOST))
$pre[0]=0;$game[0]=0;$done[0]=0;
-$r=DB_query("SELECT COUNT(id) FROM Game GROUP BY status");
-if($r) {
- $pre = DB_fetch_array($r);
- $game = DB_fetch_array($r);
- $done = DB_fetch_array($r);
- }
+$r=DB_query("SELECT COUNT(*) FROM Game where status='pre'");
+if($r) $pre = DB_fetch_array($r);
+
+$r=DB_query("SELECT COUNT(*) FROM Game where status='play'");
+if($r) $game = DB_fetch_array($r);
+
+$r=DB_query("SELECT COUNT(*) FROM Game where status='gameover'");
+if($r) $done = DB_fetch_array($r);
+
$r=DB_query("SELECT AVG(datediff(mod_date,create_date)) FROM Game where status='gameover' ");
if($r)