McBryver Posted March 6, 2011 Share Posted March 6, 2011 Hello everyone... My following code is supposed to order rank by from Greatest covertaction but for some reason it is ranking the greatest last eg. 900,000 Rank 1 900,001 Rank 2 900,002 Rank 3 Here is the code: <?php $q = "SELECT * FROM `accountinfo_db` ORDER BY `covertaction`, `anticovertaction` ASC"; $res = mysql_query($q) or die(mysql_error()); $i = 1; while($player=mysql_fetch_array($res)){ $id = securevar($player['id']); $time = time(); $user = securevar($player['username']); $q = "UPDATE `accountinfo_db` SET `covertrank` = '$i', `lastTurnTime` = '$time' WHERE `id` = '$id'"; if(mysql_query($q)){ echo "Covert & Anti Covert Rank set to $user as ".number_format($i)."!<br />"; } else { // query failed with an error // put your error reporting/logging code here... } $i++; } ?> Any help will be appreciated! Brian Quote Link to comment https://forums.phpfreaks.com/topic/229751-ranking-ranks-greatest-action-as-last-rank/ Share on other sites More sharing options...
McBryver Posted March 6, 2011 Author Share Posted March 6, 2011 I have tried DESC but output is the same. Quote Link to comment https://forums.phpfreaks.com/topic/229751-ranking-ranks-greatest-action-as-last-rank/#findComment-1183486 Share on other sites More sharing options...
McBryver Posted March 6, 2011 Author Share Posted March 6, 2011 Let me try to re-explain: if User 1's covertaction is 900,000 and User 2's covertaction is 900,100 and User 3's covertaction is 900,200 Rank User 1 as Rank 3 Rank User 2 as Rank 2 Rank User 3 as Rank 1 Hopefully this helps. Quote Link to comment https://forums.phpfreaks.com/topic/229751-ranking-ranks-greatest-action-as-last-rank/#findComment-1183490 Share on other sites More sharing options...
McBryver Posted March 6, 2011 Author Share Posted March 6, 2011 Bumb... 12 Houes Later Quote Link to comment https://forums.phpfreaks.com/topic/229751-ranking-ranks-greatest-action-as-last-rank/#findComment-1183613 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.