Thread: Function Help
View Single Post
  #1 (permalink)  
Old 04-20-2008, 02:47 AM
Whitey's Avatar   
Whitey Whitey is offline
Programming Professional
 
Join Date: Feb 2008
Location: Loveland, Colorado
Posts: 225
Credits: 0
Rep Power: 7
Whitey has a spectacular aura aboutWhitey has a spectacular aura aboutWhitey has a spectacular aura about
Send a message via AIM to Whitey Send a message via MSN to Whitey Send a message via Skype™ to Whitey
Default Function Help

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>'
;

Reply With Quote

Sponsored Links