KDawg08 Posted February 29, 2008 Posted February 29, 2008 How can i change it so hall of fame for money isn't based JUST on the money "ON HAND" I would like it to add up money on hand and money in the bank... Here is the code in halloffame.php (Version 1) function hof_money() { global $ir,$c,$userid; print "Showing the 20 users with the highest amount of money <table width=75%><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Money</th> </tr>"; $q=mysql_query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 ORDER BY money DESC,userid ASC LIMIT 20", $c); $p=0; while($r=mysql_fetch_array($q)) { $p++; if($r['userid'] == $userid) { $t="";$et=""; } else { $t="";$et=""; } print "<tr> <td>$t$p$et</td> <td>$t{$r['gangPREF']} {$r['username']} [{$r['userid']}]$et</td> <td>$t\$".money_formatter($r['money'],'')."$et</td> </tr>"; } print "</table>"; } Quote
_Eagle Posted March 4, 2008 Posted March 4, 2008 Re: Hall Of Fame Money Help (v1) function hof_money() { global $ir,$c,$userid; print "Showing the 20 users with the highest amount of money <table width=75%><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Money</th> </tr>"; $q=mysql_query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 ORDER BY money+bankmoney DESC,userid ASC LIMIT 20", $c); $p=0; while($r=mysql_fetch_array($q)) { $moneytotal=$r['money']+$r['bankmoney']; $p++; if($r['userid'] == $userid) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; } print "<tr> <td>$t$p$et</td> <td>$t{$r['gangPREF']} {$r['username']} [{$r['userid']}]$et</td> <td>$t\$".money_formatter($moneytotal,'')."$et</td> </tr>"; } print "</table>"; } Try that Quote
KDawg08 Posted March 5, 2008 Author Posted March 5, 2008 Re: Hall Of Fame Money Help (v1) Thanks, this works wonderfully. Quote
KDawg08 Posted March 10, 2008 Author Posted March 10, 2008 Re: Hall Of Fame Money Help (v1) So i thought i would add the cyber bank and it won't up my rank in the HOF for money... function hof_money() { global $ir,$c,$userid; print "Showing the 20 users with the highest amount of money <table width=75%><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Money</th> </tr>"; $q=mysql_query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 ORDER BY money+bankmoney DESC,userid ASC LIMIT 20", $c); $p=0; while($r=mysql_fetch_array($q)) { $moneytotal=$r['money']+$r['bankmoney']+$r['cybermoney']; $p++; It says I have money (9 million) should be ranked 3rd but it still shows me in 6th, Any ideas why? Quote
Analog Posted March 10, 2008 Posted March 10, 2008 Re: Hall Of Fame Money Help (v1) $q=mysql_query("SELECT * FROM users WHERE u.user_level != 0 ORDER BY money+bankmoney+cybermoney DESC,userid ASC LIMIT 20", $c); *Removed the select from gang table as its not needed from what I can tell. No need to query info that isn't being used. Quote
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.