Zoe Skandinavia
Member
- Joined
- Jul 18, 2014
- Messages
- 193
- Solutions
- 2
- Reaction score
- 15
Hi!, i tried to order the highscores by the reset times (storage) but i can't!. This is my code:
Actually it's ordered by Level, but i want that if a player is level 1200 with 2 resets compared with a player level 3000 with 1 reset, the player with level 1200 and 2 resets will be over the another player. In little words, the highscore is based on the number of resets. Please help me!. Thanks
PHP:
<?php
$limitt = 5;
$skills = mysql_select_multi("SELECT `name`,`level`,`experience` FROM `players` WHERE `group_id` < '2' AND `name` != 'Account Manager' ORDER BY `level` DESC, `experience` DESC LIMIT $limitt");
$playerID = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '".$skills['name']."' LIMIT 5");
$number_of_rows = 0;
$resets = mysql_select_single("SELECT `value` FROM `player_storage` WHERE (`key` = 86228 AND `player_id` = '". $playerID['id'] ."') LIMIT $limitt");
if ($resets['value'] == -1) { $reset = "Not Ready"; }
elseif ($resets['value'] == 0) { $reset = "Unranked"; }
elseif ($resets['value'] == 1) { $reset = "Bronze"; }
elseif ($resets['value'] == 2) { $reset = "Silver"; }
elseif ($resets['value'] == 3) { $reset = "Ore"; }
elseif ($resets['value'] == 4) { $reset = "Platinum"; }
else { $reset = "Not ready"; }
foreach($skills as $skillss) {
$number_of_rows++;
echo '+ <b></b><a href="characterprofile.php?name='.urlencode($skillss['name']).'" class="menu">'.$skillss['name'].'</a><br>';
echo '<em class="style2">Level: <b>'.urlencode($skillss['level']).'</b></em></li><br />';
echo '<em class="style2">Resets: <b>'.urlencode($reset).'</b></em></li><br />';
}
?>
Actually it's ordered by Level, but i want that if a player is level 1200 with 2 resets compared with a player level 3000 with 1 reset, the player with level 1200 and 2 resets will be over the another player. In little words, the highscore is based on the number of resets. Please help me!. Thanks