BUGFIX: db_format_game wasn't working any more
[e-DoKo.git] / include / db.php
index b7c6f707fd2c8abf786589def567346bc3bc6a01..2cc94e97497ec2a904de2655f2ef684d4947760a 100644 (file)
@@ -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];
 }