Jump to content

Ranking Ranks Greatest Action as Last Rank


McBryver

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.