From 72815ec89838ce9f17aa51224471696c52edf748 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Fri, 7 Dec 2007 16:31:50 +0100 Subject: [PATCH] BUGFIX: the number of extra points per Game where not calculated on a per Game base, but all Games where added up fixed now --- stats.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/stats.php b/stats.php index 83106cf..f5ce3c0 100644 --- a/stats.php +++ b/stats.php @@ -19,7 +19,6 @@ if(DB_open()<0) /* start a session, if it is not already running */ session_start(); - /* done major error checking, output header of HTML page */ output_header(); @@ -80,6 +79,16 @@ else if( isset($_SESSION["name"]) ) $GameN = $r[0]; echo " $GameN

\n"; + echo "

The contra party wins in "; + $result = mysql_query("SELECT COUNT(*) from Score". + " LEFT JOIN Game ON Game.id=game_id". + " WHERE score='againstqueens'". + " AND Game.status='gameover'"); + while( $r = mysql_fetch_array($result,MYSQL_NUM)) + echo $r[0]; + echo " games

\n"; + + /* number of solos */ echo "

These kind of games have been played this often:
"; $result = mysql_query("SELECT COUNT(*) as c,type from Game". @@ -87,7 +96,7 @@ else if( isset($_SESSION["name"]) ) " GROUP BY type". " ORDER BY c DESC"); while( $r = mysql_fetch_array($result,MYSQL_NUM)) - echo "".$r[1]." (".$r[0].")
"; + echo "".$r[1]." (".$r[0].")
"; echo "

\n"; /* break up solos in types */ @@ -113,12 +122,12 @@ else if( isset($_SESSION["name"]) ) select id,type,solo,status from game where id in (select id from game where randomnumbers in (select randomnumbers from game where id=27)); */ - echo "

Most extra points in a game::
\n"; + echo "

Most extra points (doko, fox, karlchen) in a game::
\n"; $result = mysql_query("SELECT COUNT(*) as c,fullname FROM Score". " LEFT JOIN User ON User.id=winner_id" . " WHERE score IN ('fox','doko','karlchen')". - " GROUP BY fullname". - " ORDER BY c DESC LIMIT 1" ); + " GROUP BY game_id,fullname". + " ORDER BY c DESC LIMIT 3" ); while( $r = mysql_fetch_array($result,MYSQL_NUM)) echo $r[1]." (".$r[0].")
\n"; echo "

\n"; @@ -202,15 +211,6 @@ else if( isset($_SESSION["name"]) ) echo " games

\n"; */ - echo "

The contra party wins in "; - $result = mysql_query("SELECT COUNT(*) from Score". - " LEFT JOIN Game ON Game.id=game_id". - " WHERE score='againstqueens'". - " AND Game.status='gameover'". - " AND Game.type<>'solo'"); - while( $r = mysql_fetch_array($result,MYSQL_NUM)) - echo $r[0]; - echo " games

\n"; /* how often is the last trick a non-trump trick -- 2.34.1