Duplicates in Rankings Paginate and some CSS.

Results 1 to 6 of 6
  1. #1
    DRGunZ 2 Creator wesman2232 is offline
    MemberRank
    Jan 2007 Join Date
    Erie, PALocation
    4,872Posts

    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&amp;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&amp;page=$prev'>Prev</a>";
            }else{
                
    $paginate.= "<span class='disabled'>Prev</span>";    }
                
            
    // Pages    
            
    if ($lastpage + ($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&amp;page=$counter'>$counter</a>";}                    
             }
             }elseif(
    $lastpage + ($stages 2)){
            
    // Beginning only hide later pages
            
    if($page + ($stages 2)){
            for (
    $counter 1$counter + ($stages 2); $counter++){
            if (
    $counter == $page){
             
    $paginate.= "<span class='current'>$counter</span>";
            }else{
             
    $paginate.= "<a href='index.php?act=rankings&amp;page=$counter'>$counter</a>";}                    
            }
            
    $paginate.= "...";
            
    $paginate.= "<a href='index.php?act=rankings&amp;page=$LastPagem1'>$LastPagem1</a>";
            
    $paginate.= "<a href='index.php?act=rankings&amp;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&amp;page=1'>1</a>";
              
    $paginate.= "<a href='index.php?act=rankings&amp;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&amp;page=$counter'>$counter</a>";}                    
            }
                
    $paginate.= "...";
                
    $paginate.= "<a href='index.php?act=rankings&amp;page=$LastPagem1'>$LastPagem1</a>";
                
    $paginate.= "<a href='index.php?act=rankings&amp;page=$lastpage'>$lastpage</a>";        
        }else{
            
    $paginate.= "<a href='index.php?act=rankings&amp;page=1'>1</a>";
            
    $paginate.= "<a href='index.php?act=rankings&amp;page=2'>2</a>";
            
    $paginate.= "...";
        for (
    $counter $lastpage - (+ ($stages 2)); $counter <= $lastpage$counter++){
        if (
    $counter == $page){
            
    $paginate.= "<span class='current'>$counter</span>";
        }else{
            
    $paginate.= "<a href='index.php?act=rankings&amp;page=$counter'>$counter</a>";}                    
        }
        }
        }            
        
    // Next
        
    if ($page $counter 1){ 
            
    $paginate.= "<a href='index.php?act=rankings&amp;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.
    Last edited by wesman2232; 05-01-13 at 05:00 AM.


  2. #2
    Praise the Sun! Solaire is offline
    MemberRank
    Dec 2007 Join Date
    Undead BurgLocation
    2,862Posts

    Re: Duplicates in Rankings Paginate and some CSS.

    What are you trying to create, just a simple ranking page?

  3. #3
    DRGunZ 2 Creator wesman2232 is offline
    MemberRank
    Jan 2007 Join Date
    Erie, PALocation
    4,872Posts

    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.

  4. #4
    Pee Aitch Pee Dave is offline
    MemberRank
    Mar 2011 Join Date
    The NetherlandsLocation
    722Posts

    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.
    Last edited by Dave; 06-01-13 at 10:55 AM.

  5. #5
    Praise the Sun! Solaire is offline
    MemberRank
    Dec 2007 Join Date
    Undead BurgLocation
    2,862Posts

    Re: Duplicates in Rankings Paginate and some CSS.

    Try something like this:

    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.

  6. #6
    DRGunZ 2 Creator wesman2232 is offline
    MemberRank
    Jan 2007 Join Date
    Erie, PALocation
    4,872Posts

    Re: Duplicates in Rankings Paginate and some CSS.

    Quote Originally Posted by SuperWaffle View Post
    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 View Post
    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.



Advertisement