Lost Password?


Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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
Rep Power: 6
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>'
;

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 04-20-2008, 02:19 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: On God's Planet
Posts: 9,583
Last Blog:
Web slideshow in JavaS...
Rep Power: 76
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: Function Help

So what do you want from us?
__________________


Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-20-2008, 03:27 PM
Whitey's Avatar   
Whitey Whitey is offline
Programming Professional
 
Join Date: Feb 2008
Location: Loveland, Colorado
Posts: 225
Rep Power: 6
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 Re: Function Help

Quote:
i am trying to make a statistic to count all the numbers for each main game.
here is my function so far
this
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-21-2008, 01:53 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: On God's Planet
Posts: 9,583
Last Blog:
Web slideshow in JavaS...
Rep Power: 76
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: Function Help

What does it do at the mo?
__________________


Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-21-2008, 04:03 PM
Whitey's Avatar   
Whitey Whitey is offline
Programming Professional
 
Join Date: Feb 2008
Location: Loveland, Colorado
Posts: 225
Rep Power: 6
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 Re: Function Help

mo = moment?

Well it dont work at the moment.. so... lol i am trying to count each person who has each game selected.. dono else how to explain it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 04-22-2008, 07:55 AM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: On God's Planet
Posts: 9,583
Last Blog:
Web slideshow in JavaS...
Rep Power: 76
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: Function Help

Yes, in colloquial English, mo = moment.
__________________


Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-22-2008, 11:10 PM
Whitey's Avatar   
Whitey Whitey is offline
Programming Professional
 
Join Date: Feb 2008
Location: Loveland, Colorado
Posts: 225
Rep Power: 6
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 Re: Function Help

Okay there is a Mysql DATABASE
with 2 Tables
1 is GamesPlayed
another is Members

In games played there are the following fields:
id
gamename
gamepic
statnames
outsidelink

In Members there the following fields:

ID
Username
Password
maingame

The main game field is an ID from the GamesPlayed Table..

So..
there are 5 members lets say
and there are 3 games..
and its filled out like this

ID: 1
Username: Joe
Password: test
maingame: 1

ID: 2
Username: Bob
Password: test
maingame: 1

ID: 3
Username: kiddney
Password: test
maingame: 3

ID: 4
Username: sally
Password: test
maingame: 1

ID: 5
Username: sid
Password: test
maingame: 2

now i am trying to write a function that that pulls out the ID number from the Members page of each members and counts them.
So it should return
Main Game: 1 Members = 3
Main Game: 2 Members = 1
Main Game: 3 Members = 1
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-23-2008, 01:03 AM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default Re: Function Help

I guess you can try something like this:
PHP Code:
$q1 "SELECT `id` FROM `GamesPlayed`";
$result mysql_query($q1);
$row mysql_fetch_array($result);
$max count($row);

for(
$i 0$i <= $maxi++)
{
    
$q2 "SELECT `id` FROM `Members` WHERE `maingame` = '".$row[$i]."'";
    
$result2 mysql_query($q2);
    echo 
$row[$i] . "-->" mysql_num_rows($result);

__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-23-2008, 02:05 PM
Whitey's Avatar   
Whitey Whitey is offline
Programming Professional
 
Join Date: Feb 2008
Location: Loveland, Colorado
Posts: 225
Rep Power: 6
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 Re: Function Help

i am trying to count each how many members have it selected.. not how many in gamesplayed.. well look at my function.. it shows what i am trying to do.. but it comes out blank.

Here let me show you visually since you guys dont understand.
Clan Hectic Defiance

See where it Says GAME. on all the member

I am making a statistic where it counts all the people with each game.. so
look at my function..
i know its almost right but it keeps coming up blank..

Last edited by Whitey; 04-23-2008 at 02:11 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-23-2008, 02:39 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default Re: Function Help

This:
Code:
"SELECT `id` FROM `Members` WHERE `maingame` = '1'";
Will generate a query of member id's, that have the game with the id 1 as their main game. Is that not what you want?
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inline function Chinmoy C Tutorials 1 04-07-2008 04:13 PM
using Template function Chinmoy C Tutorials 4 04-03-2008 05:16 AM
function pointer Chinmoy C Tutorials 0 03-19-2008 01:52 AM
SecurityAudit vinay Visual Basic Programming 27 01-07-2008 01:14 PM


All times are GMT -5. The time now is 07:01 AM.