Ich have a MySQL Table games:
Gid (auto)
Tid (number from other table tournament)
Gaway (Player1)
Ghome (Player2)
Gwon (Player1)
The content of table games is
Gid (1,2,3,4...)
Tid (1,1,1,1...)
Gaway (Player1, Player2, Player3, Player4...)
Ghome (Player3, Player4, Player4, Player1...)
Gwon (Player1, Player4, Player4, Player4...)
I read the number of gwon with the following:
prepare(„SELECT tid, ghome, gaway, gwon, COUNT(gwon) AS anzahl FROM games WHERE tid = ‚“.$_GET[‚tid‘].“‘ AND gwon NOT LIKE ‚draw‘ GROUP BY gwon ORDER BY anzahl DESC“);
$stat->execute();
$i = 1;
While($row = $stat->fetch())
{
Echo $i;
$row['gwon'];
$row['anzahl'];
$i++;
}
?>
Now he sums up the winning games and groups them together to gwon. With it I create a ranking.
Space | name | points
1 | Player4 | 3
2 | Player1 | 1
The problem is, if someone has not yet won (in the example Player2 and Player3) , then he will not appear in the ranking. Does anyone have an idea how to still spend the players in the ranking? For example
Space | name | points
1 | Player4 | 3
2 | Player1 | 1
3 | Player2 | 0
3 | Player3 | 0