jamiee Posted September 23, 2009 Share Posted September 23, 2009 :::::::::::::::::: Player Statistics :::::::::::::::::::: Screenshot: Make player_stats.php add code below: <?php require("top.php"); require("connect.php"); ?> <form method="post"> <html> <Head> </Head> <body> <table width="350" border="0" align="center" cellspacing="2" class="table"> <tr> <td width="350" Class="head" colspan="4" align="left">Site Statistics</td> </tr> <tr> <td width="35%" align="left" class="sub">Total Members:</td> <td width="65%" align="left" class="cell"><?php $res = "SELECT name FROM login"; $tquery = mysql_query($res) or die(mysql_error()); $total_members = mysql_num_rows($tquery); echo number_format($total_members); ?></td> </tr> <tr> <td align="left" class="sub">Members Dead:</td> <td align="left" class="cell"><?php $res = "SELECT name FROM login WHERE sitestate='2'"; $tquery = mysql_query($res) or die(mysql_error()); $totalmembers = mysql_num_rows($tquery); echo number_format($totalmembers); ?></td> </tr> <tr> <td align="left" class="sub">Members Alive:</td> <td align="left" class="cell"><?php $res = "SELECT name FROM login WHERE sitestate='9'"; $tquery = mysql_query($res); $totalmembers = mysql_num_rows($tquery); $tres = "SELECT name FROM login WHERE sitestate='0'"; $ttquery = mysql_query($tres); $atotalmembers = mysql_num_rows($ttquery); $ttotalmembers= $atotalmembers + $totalmembers; echo number_format($ttotalmembers); ?></td> </tr> <tr> <td align="left" class="sub">Swiss bank:</td> <td align="left" class="cell"><?php $query = "SELECT SUM(amount) FROM swiss_bank"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); $swiss_bank = $row['SUM(amount)']; echo "$ ".number_format($row['SUM(amount)']).",-"; ?></td> </tr> <tr> <td width="35%" align="left" class="sub">Total Money:</td> <td width="65%" align="left" class="cell"><?php $query = "SELECT SUM(money) FROM login WHERE staff='0'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); $cash = $row['SUM(money)']; echo "$ ".number_format($row['SUM(money)']).",-"; ?></td> </tr> <tr> <td width="35%" align="left" class="sub">Total Gang Money:</td> <td width="65%" align="left" class="cell"><?php $query = "SELECT SUM(bank) FROM gangs"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); $gang_money = $row['SUM(bank)']; echo "$ ".number_format($row['SUM(bank)']).",-"; ?></td> </tr> <tr> <td width="35%" align="left" class="sub">Most Members Online:</td> <td width="65%" align="left" class="cell"><?php $query = "SELECT max_online FROM sitestats WHERE id='1'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); echo $row['max_online']; ?></td> </tr> </table> </fieldset> <table width="350" border="0" align="center" cellpadding="0" cellspacing="2" class="table"> <tr> <td colspan="4" align="left" class="head">Last 20 Kills: </td> </tr> <tr> <td width="125" align="left" class="sub">[b]Name:[/b]</td> <td width="125" align="left" class="sub">[b]Rank:[/b]</td> <td width="250" align="left" class="sub">[b]Gang:[/b]</td> </tr> <? $result = mysql_query("SELECT * FROM kills WHERE state='1' ORDER BY id DESC LIMIT 0,20 ") or die(mysql_error()); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table ?> <tr> <td width="125" align="left" class="cell"><?php echo "<a href=\"view_profile.php?name=". $row['target'] ."\" onFocus=\"if(this.blur)this.blur()\">".$row['target']."</a>"; ?></td> <td width="125" align="left" class="cell"><?php echo $rank_array[$row['rank'] - 1]; ?></td> <td width="250" align="left" class="cell"><?php if(empty($row['gang'])){ echo "No Gang."; }else{ echo $row['gang']; }?> <?php }// end while lop.?> </tr> </table> <table width="350" border="0" align="center" cellpadding="0" cellspacing="2" class="table"> <tr> <td colspan="4" align="left" class="head">Last 20 Signups: </td> </tr> <tr> <td width="125" align="left" class="sub">[b]Name:[/b]</td> <td width="225" align="left" class="sub">[b]Signup Date:[/b]</td> </tr> <form> <?php $result = mysql_query("SELECT * FROM login ORDER BY id DESC LIMIT 0,20 ") or die(mysql_error()); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { ?> <tr> <td width="125" align="left" class="cell"><?php echo"<a href=\"view_profile.php?name=". $row['name'] ."\" onFocus=\"if(this.blur)this.blur()\">".$row['name']."</a>";?></td> <td width="225" align="left" class="cell" ><?php echo $row['signup']; ?></td> </tr> <?php }// while loop?> </table> </body> </html> <? require("bottom.php") ?> Add the following code to top.php: Player Statistics Enjoy the free script. :) Quote Link to comment Share on other sites More sharing options...
TheBigChief Posted September 25, 2009 Share Posted September 25, 2009 I get this Unknown column 'staff' in 'where clause' Quote Link to comment Share on other sites More sharing options...
jamiee Posted September 26, 2009 Author Share Posted September 26, 2009 Add the following to the "login" SQL table: If value does not equal 0 the affected users will not show up. [mysql]`staff` int(11) NOT NULL DEFAULT '0',[/mysql] Quote Link to comment Share on other sites More sharing options...
KRB Posted January 29, 2011 Share Posted January 29, 2011 how do you run this mysql code in the login table? i get errors trying to run it #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`staff` int(11) NOT NULL DEFAULT '0',' at line 1 Quote Link to comment Share on other sites More sharing options...
Newbie Posted January 24, 2012 Share Posted January 24, 2012 (edited) how do you run this mysql code in the login table? i get errors trying to run it #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`staff` int(11) NOT NULL DEFAULT '0',' at line 1 you can add it in manaly or sumthing like this ALTER TABLE `staff` ADD int(11) NOT NULL DEFAULT '0' never used the gl enine before so i dunno Edited January 24, 2012 by Newbie Quote Link to comment Share on other sites More sharing options...
Maniak Posted January 24, 2012 Share Posted January 24, 2012 The SQL above is wrong. If it goes in the Login table then the code you will need to run is: ALTER TABLE `login` ADD `staff` int(11) NOT NULL DEFAULT '0' Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.