summaryrefslogtreecommitdiffstats
path: root/include/db.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2008-08-19 18:14:13 -0700
committerArun Persaud <arun@nubati.net>2008-08-19 18:14:13 -0700
commit53d9b086ef0b8a5e210a5713dcd944c16bd39bc8 (patch)
tree57ac3cde4c1e471f4919fede4ef996e523d191f3 /include/db.php
parent1c3c341f53ce5de7e9d4bcc63e43a925faec3f48 (diff)
downloade-DoKo-53d9b086ef0b8a5e210a5713dcd944c16bd39bc8.tar.gz
e-DoKo-53d9b086ef0b8a5e210a5713dcd944c16bd39bc8.tar.bz2
e-DoKo-53d9b086ef0b8a5e210a5713dcd944c16bd39bc8.zip
BUGFIX: db_format_game wasn't working any more
mysql's TIMEDIFF seems to have changed... comparing <=0 didn't work correctly anymore. Changed it to convert to seconds and then compare those against <=0 and use that data to calculate game number Signed-off-by: Arun Persaud <arun@nubati.net>
Diffstat (limited to 'include/db.php')
-rw-r--r--include/db.php7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/db.php b/include/db.php
index b7c6f70..2cc94e9 100644
--- a/include/db.php
+++ b/include/db.php
@@ -877,10 +877,9 @@ function DB_format_gameid($gameid)
$session = DB_get_session_by_gameid($gameid);
/* get number of game */
- $r = DB_query_array("SELECT COUNT(*),create_date FROM Game".
- " WHERE session='$session' ".
- " AND TIMEDIFF(create_date, (SELECT create_date FROM Game WHERE id='$gameid'))<=0 ".
- " GROUP by session");
+ $r = DB_query_array("SELECT SUM(TIME_TO_SEC(TIMEDIFF(create_date, (SELECT create_date FROM Game WHERE id='$gameid')))<=0) ".
+ " FROM Game".
+ " WHERE session='$session' ");
return $session.".".$r[0];
}