Duplicates in Rankings Paginate and some CSS.
I'm having duplicates on my rankings and lists that I'm using.
I changed the * to CID to select only what I need, but I'm not sure if it's doing the same as *
I asked Vusion for help first, and he told me to look at his IGunZ website, but it's completely different from the one I'm using.
PHP Code:
<?php
$limit = 25;
$queryq = "SELECT COUNT(CID) as num FROM Character";
$total_pages = mssql_fetch_assoc(mssql_query($queryq));
$total_pages = $total_pages['num'];
$stages = 3;
$page = anti_injection($_GET['page']);
if($page){
$start = ($page - 1) * $limit;
}else{
$start = 0;
}
$sqlplayer = mssql_query("SELECT TOP $limit AID, CID, Level, XP, KillCount, DeathCount FROM Character WHERE CID not in (SELECT TOP $start CID FROM Character ORDER BY XP DESC) AND DeleteFlag='0' ORDER BY Level DESC,XP DESC,KillCount DESC,DeathCount DESC");
if(mssql_num_rows($sqlplayer)<>0){
$count=1+$start;
while($char = mssql_fetch_assoc($sqlplayer)){
echo '<tr style="height:18px;"><td>'.$count.'.</td>';
echo '<td><a href="index.php?act=profile&aid='.$char['AID'].'">'.Char($char['CID']).'</a></td>';
echo '<td>'.$char['Level'].'</td>';
echo '<td>'.$char['XP'].'</td>';
echo '<td>'.$char['KillCount'].'</td>';
echo '<td>'.$char['DeathCount'].'</td></tr>';
$count++;
}
}else{
echo "<tr><td></td></tr>";
}
//Paginate Start
if ($page == 0){$page = 1;}
$prev = $page - 1;
$next = $page + 1;
$lastpage = ceil($total_pages/$limit);
$LastPagem1 = $lastpage - 1;
$paginate = '';
if($lastpage > 1){
$paginate .= "<div class='paginate'>";
// Previous
if ($page > 1){
$paginate.= "<a href='index.php?act=rankings&page=$prev'>Prev</a>";
}else{
$paginate.= "<span class='disabled'>Prev</span>"; }
// Pages
if ($lastpage < 7 + ($stages * 2)){
for ($counter = 1; $counter <= $lastpage; $counter++){
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='index.php?act=rankings&page=$counter'>$counter</a>";}
}
}elseif($lastpage > 5 + ($stages * 2)){
// Beginning only hide later pages
if($page < 1 + ($stages * 2)){
for ($counter = 1; $counter < 4 + ($stages * 2); $counter++){
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='index.php?act=rankings&page=$counter'>$counter</a>";}
}
$paginate.= "...";
$paginate.= "<a href='index.php?act=rankings&page=$LastPagem1'>$LastPagem1</a>";
$paginate.= "<a href='index.php?act=rankings&page=$lastpage'>$lastpage</a>";
// Middle hide some front and some back
}elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2)){
$paginate.= "<a href='index.php?act=rankings&page=1'>1</a>";
$paginate.= "<a href='index.php?act=rankings&page=2'>2</a>";
$paginate.= "...";
for ($counter = $page - $stages; $counter <= $page + $stages; $counter++){
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='index.php?act=rankings&page=$counter'>$counter</a>";}
}
$paginate.= "...";
$paginate.= "<a href='index.php?act=rankings&page=$LastPagem1'>$LastPagem1</a>";
$paginate.= "<a href='index.php?act=rankings&page=$lastpage'>$lastpage</a>";
}else{
$paginate.= "<a href='index.php?act=rankings&page=1'>1</a>";
$paginate.= "<a href='index.php?act=rankings&page=2'>2</a>";
$paginate.= "...";
for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++){
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='index.php?act=rankings&page=$counter'>$counter</a>";}
}
}
}
// Next
if ($page < $counter - 1){
$paginate.= "<a href='index.php?act=rankings&page=$next'>next</a>";
}else{
$paginate.= "<span class='disabled'>next</span>";
}
$paginate.= "</div>";
}
//Paginate End
echo "<tr><td align='center' colspan='6' style='padding-top:10px;'>";
echo $paginate;
echo "</td></tr>";
?>
I'm trying to increase the size of the image border so I can include a bigger image. I change the size in the code that deals with displaying the border image, the dimensions in the style.css, and even the size of the image itself, but it still stays the same. If I put a bigger image than 86x68 as the image, it overlaps the border.
http://img801.imageshack.us/img801/1267/css2h.png
Thanks.
Re: Duplicates in Rankings Paginate and some CSS.
What are you trying to create, just a simple ranking page?
Re: Duplicates in Rankings Paginate and some CSS.
This was the included rankings page, and I have made account/character/and clan lists with this.
The first page is fine, but the second page will load the last 4 of the last page and display it again at the top of the page, creating duplicates. Basically I'm trying to make a rankings page with pagination.
Re: Duplicates in Rankings Paginate and some CSS.
Probably because you forgot to put "ORDER BY Level DESC,XP DESC,KillCount DESC,DeathCount DESC" in your NOT IN query.
You only made it ORDER BY XP DESC.
Re: Duplicates in Rankings Paginate and some CSS.
Try something like this:
Quote:
SELECT TOP $limit * FROM Character WHERE CID NOT IN (SELECT TOP $start CID FROM Character ORDER BY XP DESC) AND DeleteFlag='0' ORDER BY XP DESC
Also, hands down, but you should definitely cache this and refresh like once every 30 minutes, kids refreshing that page all day long will result in quite some serverload.
Re: Duplicates in Rankings Paginate and some CSS.
Quote:
Originally Posted by
SuperWaffle
Probably because you forgot to put "ORDER BY Level DESC,XP DESC,KillCount DESC,DeathCount DESC" in your NOT IN query.
You only made it ORDER BY XP DESC.
I'll try that.
Quote:
Originally Posted by
Wizkidje
Try something like this:
Also, hands down, but you should definitely cache this and refresh like once every 30 minutes, kids refreshing that page all day long will result in quite some serverload.
Alright, I'll do that. If I need help, I'll ask here.