Games statistic forum..
gamesplayed list all the games available with the ID number
member is the members profile with the main game selected
i am trying to make a statistic to count all the numbers for each main game.
here is my function so far
PHP Code:
function getGameStats()
{
global $dbprefix;
$query = "SELECT * FROM {$dbprefix}gamesplayed";
$result = mysql_query($query)
or die(mysql_error());
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>';
for ($i = 0; $i < mysql_num_rows($result); $i = $i + 1)
{
$gamepic = mysql_result($result, $i, "gamepic");
$gamename = mysql_result($result, $i, "gamename");
$id = mysql_result($result, $i, "ID");
$query = "SELECT maingame, COUNT('".$id."') FROM {$dbprefix}members GROUP BY maingame";
$result = mysql_query($query) or die(mysql_error());
$stat = mysql_result($result);
echo ("<td><div align='center'>$stat</div></td>");
}
echo ' </tr>
</table>';
}