From: Arun Persaud Date: Wed, 20 Aug 2008 01:14:13 +0000 (-0700) Subject: BUGFIX: db_format_game wasn't working any more X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=commitdiff_plain;h=53d9b086ef0b8a5e210a5713dcd944c16bd39bc8;hp=1c3c341f53ce5de7e9d4bcc63e43a925faec3f48;ds=sidebyside 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 --- 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]; }