Jump to content
MakeWebGames

[v1] Updated Statistics Page


oxidati0n

Recommended Posts

This shows everything in your game, Males, females, donators, top donators, top gangs, how many people have a certain house, it all..

and it costs... NOTHING!

FREE TO ALL! Enjoy!

replace stats.php with this

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Link to comment
Share on other sites

Re: [v1] Updated Statistics Page

here it is for v2 am using oxidation code but i just convist it for the people who cant

 

<?php

include "globals.php";

$q=mysql_query("SELECT userid FROM users",$c);

$membs=mysql_num_rows($q);

$q=mysql_query("SELECT userid FROM users WHERE bankmoney>-1",$c);

$banks=mysql_num_rows($q);

$q=mysql_query("SELECT userid FROM users WHERE gender='Male'",$c);

$male=mysql_num_rows($q);

$q=mysql_query("SELECT userid FROM users WHERE gender='Female'",$c);

$fem=mysql_num_rows($q);

$total=0;

$q=mysql_query("SELECT money FROM users",$c);

while($r=mysql_fetch_array($q))

{

$total+=$r['money'];

}

$avg=(int) ($total/$membs);

$totalb=0;

$q=mysql_query("SELECT bankmoney FROM users WHERE bankmoney>-1",$c);

while($r=mysql_fetch_array($q))

{

$totalb+=$r['bankmoney'];

}

$avgb=(int) ($totalb/$banks);

$totalc=0;

$q=mysql_query("SELECT crystals FROM users",$c);

while($r=mysql_fetch_array($q))

{

$totalc+=$r['crystals'];

}

$totali=0;

$q=mysql_query("SELECT inv_qty FROM inventory",$c);

while($r=mysql_fetch_array($q))

{

$totali+=$r['inv_qty'];

}

$avgc=(int) ($totalc/$membs);

$q=mysql_query("SELECT mail_id FROM mail",$c);

$mail=mysql_num_rows($q);

$q=mysql_query("SELECT evID FROM events",$c);

$events=mysql_num_rows($q);

$nogender1=mysql_query("SELECT * FROM users WHERE gender=''",$c);

$nogender=mysql_num_rows($nogender1);

$maleperc=round($male/$membs*100).'%';

$femaleperc=round($fem/$membs*100).'%';

$nogenderperc=round($nogender/$membs*100).'%';

$highestdonator1=mysql_query("SELECT * FROM users ORDER BY donatordays DESC LIMIT 1;",$c);

$hd=mysql_fetch_array($highestdonator1);

print "<h3>Statistics Department</h3>

You walk through the statistics centre and stare at the boards.

<table width='90%' style='border:groove; border-color:chocolate;'><tr><th>Users</th><th>Houses</th><th><th>Cities</th></tr>

<tr><td>There are currently $membs members signed up

$male ($maleperc) males, $fem ($femaleperc) females and $nogender ($nogenderperc) multigenders.

There are ".mysql_num_rows(mysql_query("SELECT * FROM users WHERE donatordays>0",$c))." donators

";

if(mysql_num_rows($highestdonator1) != 0)

{

print "The highest current donator is {$hd['username']}

";

}

print "</td> <td>This how many members have amount of each house

";

$q=mysql_query("SELECT * FROM houses ORDER BY hPRICE,hWILL ASC",$c);

while($r=mysql_fetch_array($q))

{

$q3=mysql_num_rows(mysql_query("SELECT * FROM users WHERE maxwill={$r['hWILL']}",$c));

print "".$r['hNAME']." - $q3 users have it

";

}

print "..and ".mysql_num_rows(mysql_query("SELECT * FROM users WHERE maxwill<='100'",$c))." dont have a house.";

print "</td><td>";

$q=mysql_query("SELECT * FROM cities ORDER BY cityname ASC",$c);

while($r=mysql_fetch_array($q))

{

$q3=mysql_num_rows(mysql_query("SELECT * FROM users WHERE location={$r['cityid']}",$c));

$hmhi=round($q3/$membs*100).'%';

print "".$r['cityname']." - $q3 users have it ({$hmhi})

";

}

print "</td></tr>

<tr><th>Financial</th><th>Gangs</th><th>Mail/Events</th></tr>

<tr><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 accnt: \$".money_formatter($avgb,"").".

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

The average player has: ".money_formatter($avgc,"")." crystals.</td> <td>";

$gangs=mysql_num_rows(mysql_query("SELECT gangID FROM gangs",$c));

$bg1=mysql_query("SELECT * FROM gangs ORDER BY gangRESPECT DESC LIMIT 1",$c);

$bg=mysql_fetch_array($bg1);

print "There are currently $gangs in circulation.

";

if(mysql_num_rows($bg1) != 0)

{

print "The best gang is {$bg['gangNAME']}

";

}

print "</td><td><u>Mails/Events</u>

".money_formatter($mail,"")." mails and ".money_formatter($events,"")." events have been sent.</td></tr>

<tr><th>Items</th><th> </th><th> </th></tr>

<tr><td>There are currently ".money_formatter($totali,"")." items in circulation.</td><td></td><td></td> </tr>

</table>

 

";

$h->endpage();

?>

Link to comment
Share on other sites

Re: [v1] Updated Statistics Page

sorry but this is not converted right to v2

you need to change the :

mysql_num_rows====to ==$db->num_rows

you alson need to take out all the ,$c from all the $db->query lines

and mysql_fetch_array should be=$db->fetch_row

hope this helps you

 

here it is for v2 am using oxidation code but i just convist it for the people who cant

 

<?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->etch_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);

$nogender1=$db->query("SELECT * FROM users WHERE gender='');

$nogender=$db->num_rows($nogender1);

$maleperc=round($male/$membs*100).'%';

$femaleperc=round($fem/$membs*100).'%';

$nogenderperc=round($nogender/$membs*100).'%';

$highestdonator1=$db->query("SELECT * FROM users ORDER BY donatordays DESC LIMIT 1;");

$hd=$db->fetch_row($highestdonator1);

print "<h3>Statistics Department</h3>

You walk through the statistics centre and stare at the boards.

<table width='90%' style='border:groove; border-color:chocolate;'><tr><th>Users</th><th>Houses</th><th><th>Cities</th></tr>

<tr><td>There are currently $membs members signed up

$male ($maleperc) males, $fem ($femaleperc) females and $nogender ($nogenderperc) multigenders.

There are ".$db->num_rows($db->query("SELECT * FROM users WHERE donatordays>0"))." donators

";

if($db->num_rows($highestdonator1) != 0)

{

print "The highest current donator is {$hd['username']}

";

}

print "</td> <td>This how many members have amount of each house

";

$q=$db->query("SELECT * FROM houses ORDER BY hPRICE,hWILL ASC");

while($r=$db->fetch_row($q))

{

$q3=$db->num_rows($db->query("SELECT * FROM users WHERE maxwill={$r['hWILL']}");

print "".$r['hNAME']." - $q3 users have it

";

}

print "..and ".$db->num_rows(mysql_query("SELECT * FROM users WHERE maxwill<='100'",$c))." dont have a house.";

print "</td><td>";

$q=$db->query("SELECT * FROM cities ORDER BY cityname ASC");

while($r=$db->fetch_row($q)

{

$q3=$db->num_rows($db->query("SELECT * FROM users WHERE location={$r['cityid']}");

$hmhi=round($q3/$membs*100).'%';

print "".$r['cityname']." - $q3 users have it ({$hmhi})

";

}

print "</td></tr>

<tr><th>Financial</th><th>Gangs</th><th>Mail/Events</th></tr>

<tr><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 accnt: \$".money_formatter($avgb,"").".

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

The average player has: ".money_formatter($avgc,"")." crystals.</td> <td>";

$gangs=$db->num_rows($db->query("SELECT gangID FROM gangs",$c));

$bg1=mysql_query("SELECT * FROM gangs ORDER BY gangRESPECT DESC LIMIT 1");

$bg=$db->fetch_row($bg1);

print "There are currently $gangs in circulation.

";

if($db->num_rows($bg1) != 0)

{

print "The best gang is {$bg['gangNAME']}

";

}

print "</td><td><u>Mails/Events</u>

".money_formatter($mail,"")." mails and ".money_formatter($events,"")." events have been sent.</td></tr>

<tr><th>Items</th><th> </th><th> </th></tr>

<tr><td>There are currently ".money_formatter($totali,"")." items in circulation.</td><td></td><td></td> </tr>

</table>

 

";

$h->endpage();

?>

 

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • 4 months later...

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.

×
×
  • Create New...