diff options
author | Matthijs Kuiper <info@matthijskuiper.nl> | 2017-02-04 23:57:49 +0100 |
---|---|---|
committer | Matthijs Kuiper <info@matthijskuiper.nl> | 2017-02-06 23:21:12 +0100 |
commit | 7abeb203d8b6d537a55b0dd9a1ccac32e6f948ec (patch) | |
tree | e09f373a1441fe6b7acbb7672e671e5fb1044d4a /html/pages/home.php | |
parent | c110e3ac9e2fac2f88f4e00fa05579ab25afc3fc (diff) |
Fix MySQL ONLY_FULL_GROUP_BY errors
Diffstat (limited to 'html/pages/home.php')
-rwxr-xr-x | html/pages/home.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/html/pages/home.php b/html/pages/home.php index 3cb167d..be75b66 100755 --- a/html/pages/home.php +++ b/html/pages/home.php @@ -57,10 +57,14 @@ echo' </tr>';
$sql_gamesummary = "SELECT g.id AS gid, g.name AS gamename, SUM(p.frags) AS frags, SUM(p.kills) AS kills, SUM(p.suicides) AS suicides, SUM(p.teamkills) AS teamkills, COUNT(DISTINCT p.matchid) AS matchcount
-FROM uts_player AS p, uts_games AS g WHERE p.gid = g.id GROUP BY gamename ORDER BY gamename ASC";
+FROM uts_player AS p, uts_games AS g
+WHERE p.gid = g.id
+GROUP BY gamename, gid
+ORDER BY gamename ASC";
+
$q_gamesummary = mysql_query($sql_gamesummary) or die(mysql_error());
-while ($r_gamesummary = mysql_fetch_array($q_gamesummary)) {
+while ($r_gamesummary = mysql_fetch_array($q_gamesummary)) {
$gid = $r_gamesummary[gid];
$q_gametime = small_query("SELECT SUM(gametime) AS gametime FROM uts_match WHERE gid = '$gid'");
@@ -76,7 +80,8 @@ while ($r_gamesummary = mysql_fetch_array($q_gamesummary)) { }
$totalsummary = small_query("SELECT SUM(p.frags) AS frags, SUM(p.kills) AS kills, SUM(p.suicides) AS suicides, SUM(p.teamkills) AS teamkills, COUNT(DISTINCT p.matchid) AS matchcount, SUM(p.gametime) AS gametime
-FROM uts_player AS p, uts_games AS g WHERE p.gid = g.id");
+FROM uts_player AS p, uts_games AS g
+WHERE p.gid = g.id");
$q_gametime = small_query("SELECT SUM(gametime) AS gametime FROM uts_match");
$gametime = sec2hour($q_gametime[gametime]);
@@ -97,4 +102,4 @@ echo' <tr> $gtitle = "Across All Servers";
$bgwhere = "id >= 0";
include("pages/graph_mbreakdown.php");
-?>
\ No newline at end of file +?>
|