From 53d9b086ef0b8a5e210a5713dcd944c16bd39bc8 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Tue, 19 Aug 2008 18:14:13 -0700 Subject: [PATCH 1/1] 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 --- include/db.php | 7 +++---- 1 file 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]; } -- 2.25.1