Basic Rankings (Almost Complete) Web 

Newbie Spellweaver
Joined
Feb 17, 2015
Messages
40
Reaction score
5
So I have been recently creating a rankings page that allows you to see the top players with a prev and next button. The page is basic and shows nothing but your

Rank #
Job Icon
Level
Name
Job
Fame

Now when recently I got everything to work I noticed when clicking to the 'next' page to see the 6th best player it shows they are number 1.

$number = 1; <-- I believe it has something to do with this.

PHP:
?> 
<div id="main"> 
<div class="sidebartop"><h3>Rankings!</h3></div> 
<div class="sidebarbox"> 
<center> 
<br> 
<table border='1' bordercolor='#484846' style='border-style: solid;  border-collapse: collapse' > 
<tr > 
<div>
<th bgcolor='#484846' style='height: 10px;width: 80px; '><font color="#fff"> RANK </font></th> 
<th bgcolor='#484846' style='height: 10px;width: 80px; '><font color="#fff"> ICON </font></th> 
<th bgcolor='#484846' style='height: 10px;width: 50px; '><font color="#fff"> LEVEL </font></th> 
<th bgcolor='#484846' style='height: 10px;width: 110px;'><font color="#fff"> NAME </font></th> 
<th bgcolor='#484846' style='height: 10px;width: 100px;'><font color="#fff"> JOB </font></th> 
<th bgcolor='#484846' style='height: 10px;width: 90px; '><font color="#fff"> FAME </font></th> 
</div>
</tr> 
</table> 
<table border='1' bordercolor='#484846' style='border-style: solid;  border-collapse: collapse' > 
<?php
$number = 1;
$i = $start;
$q = mysql_query("SELECT characters.name, characters.rank, characters.job , characters.level, characters.fame, characters.level FROM characters, accounts WHERE characters.accountid=accounts.id and characters.gm = 0 and accounts.banned = 0 ORDER BY characters.level DESC LIMIT ".($start).", 5") or die ($mysqli->error());
while ($r = mysql_fetch_array($q)) {
?><tr>
<font color="#fff"> 
<td bgcolor='#fafafa'  style='width: 80px;  '><center> <?php echo $number; $number = $number+1;?> </center></td> 
<td bgcolor='#fafafa'  style='width: 80px; height: 70px;'><center> <?php echo $job[$r['job']];?> </center></td> 
<td bgcolor='#fafafa'  style='width: 50px;  '><center> <?php echo $r['level'];?> </center></b></td> 
<td bgcolor='#fafafa'  style='width: 110px; '><center> <?php echo $r['name'];?> </center></td> 
<td bgcolor='#fafafa'  style='width: 100px; '><center> <?php echo $jobs[$r['job']];?> </center></td> 
<td bgcolor='#fafafa'  style='width: 90px;  '><center> <?php echo $r['fame'];?> </center></td> 
</font> 
</tr> 
<?php } 
if ($start >= 0 && $start <= 80) {
 $nextstart = $start + 5;
 if ($start >= 6) {
  $prevstart = $start - 5;
 } else {
  $prevstart = 0;
 }
} else if ($start > 80 && $start <= 90) {
 $prevstart = $start - 5;
 $nextstart = 90;
} else {
 die("Error");
}
 ?>
</table> 
</center> 
</div> 
</div>  
<a href="?p=rankings&start=<?php echo ($prevstart);?>"><div class="button normal">Prev</div></a> 
<a href="?p=rankings&start=<?php echo ($nextstart);?>"><div class="button normal">Next</div></a>
<center></p></div>

<?php
if(basename($_SERVER["PHP_SELF"]) == "rankings.php"){
 die("Access denied.");
}
?>
 <?php
if (isset($_GET['start'])) {
 if ($_GET['start'] >= 0 && $_GET['start'] <= 90) {
  $start = ($_GET['start']);
 } else {
  die("Input not allowed.");
 }
} else {
 $start = 0;
}
?>

This is what I have to show, the rest of the code is nothing needed but for the images etc.

Can anyone please help me fix the rankings where it shows the correct rank #'s for after the top 5!
 
Back