Jump to content
MakeWebGames

Anyone Got A Working Stats.php?


SEOCM
 Share

Recommended Posts

Re: Anyone Got A Working Stats.php?

 

<?php
include "globals.php";
$q=$db->query("SELECT userid FROM users");
$membs=$db->num_rows($q);
$q=$db->query("SELECT userid FROM users WHERE bankmoney>-1");
$banks=$db->num_rows($q);
$q=$db->query("SELECT userid FROM users WHERE gender='Male'");
$male=$db->num_rows($q);
$q=$db->query("SELECT userid FROM users WHERE gender='Female'");
$fem=$db->num_rows($q);
$total=0;
$q=$db->query("SELECT money FROM users");
while($r=$db->fetch_row($q))
{
$total+=$r['money'];
}
$avg=(int) ($total/$membs);
$totalb=0;
$q=$db->query("SELECT bankmoney FROM users WHERE bankmoney>-1");
while($r=$db->fetch_row($q))
{
$totalb+=$r['bankmoney'];
}
$avgb=(int) ($totalb/$banks);
$totalc=0;
$q=$db->query("SELECT crystals FROM users");
while($r=$db->fetch_row($q))
{
$totalc+=$r['crystals'];
}
$totali=0;
$q=$db->query("SELECT inv_qty FROM inventory");
while($r=$db->fetch_row($q))
{
$totali+=$r['inv_qty'];
}
$avgc=(int) ($totalc/$membs);
$q=$db->query("SELECT mail_id FROM mail");
$mail=$db->num_rows($q);
$q=$db->query("SELECT evID FROM events");
$events=$db->num_rows($q);
print "<h3>Game Statistics</h3>
You step into the Statistics Department and login to the service. You see some stats that interest you.

<table width=75% cellspacing=1 class='table'> <tr> <th>Users</th><th>Money and crystals</th></tr><tr><td>
There are currently $membs {$set['game_name']} players, $male males and $fem females.</td>  <td>
Amount of cash in circulation: \$".money_formatter($total,"").". 

The average player has: \$".money_formatter($avg,"").". 

Amount of cash in banks: \$".money_formatter($totalb,"").". 

Amount of players with bank accounts: $banks

The average player has in their bank accounts: \$".money_formatter($avgb,"").". 

Amount of crystalss in circulation: ".money_formatter($totalc,"").". 

The average player has: ".money_formatter($avgc,"")." crystals.</td> </tr>
<tr> <th>Mails/Events</th><th>Items</th></tr><tr><td>
".money_formatter($mail,"")." mails and ".money_formatter($events,"")." events have been sent.</td> <td>
There are currently ".money_formatter($totali,"")." items in circulation.</td> </tr>
</table>";
$h->endpage();
?>

 

 

Please use [code]...[/code] tags in future

Link to comment
Share on other sites

Re: Anyone Got A Working Stats.php?

Its still showing wrong =(

Amount of cash in banks: $2,148,958,688.

Amount of players with bank accounts: 8

The average player has in their bank accounts: $268,619,836.

Thats totally wrong lmao well average player has in bank accounts is wrong -_-.

Link to comment
Share on other sites

Guest Anonymous

Re: Anyone Got A Working Stats.php?

Don't try that version of the stats page with anything more than around 10K users though -- You are liable to kill the DB server.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...