Hello to you all.

im trying to figureout how to make it possibel to make a interva list on how many pages is supposed to be listed on my paing script.

that i mean is like this.

first list page 1 2 3 4 5 when you klick on page 5 i ends upp like this 6 7 8 9 10 some thing like that in a way.

now i only have manage to make it expaned on and on sow now i would like some help from you all.

<?
if($list_total > 0) { 
         for($i = 0; $i <= $list_total; $i++) {
            if($i == $page) {
               echo " " . ($i + 1) . " ";
            } else {
               echo " <a href=\"{$_SERVER['PHP_SELF']}?type=".$_GET['type']."&page=$i\">" . ($i + 1) . "</a> ";
            }
         }
    } else {
  echo " 1 ";
}
?>

    Not blowing you off, I just don't have time to show this to you right now... but, I wanted to prod you along here..........

    Search these forums for "pagination". This topic has been beat to death pretty much since the inception of these forums.

    If you can't find what you are looking for, then take a gander at the tutorial found here and you should hopefully get an idea of how to do what you are wanting to do.

      instead of starting your for loop statically at zero start it one or two less then the current page, unless the current page is less then three.

      Also for optimization it's faster to have one for loop run for the pages below your current page, print out a non link for the current page then have a second loop for the pages after the current page.

        Okay the idée of this was to make it possible to adjust how many pages should be listed as an URL.

        sow it made a simple for loop the i had the idée that i seen lots of people making i look like this in there url 1 2 3 4 5 8 12 and sow on, sow I thought wow way do i not make something like that in my script.

        I thought i some minuts and got the idee that must be away to make it possibel to jump in the for loop to page 5 and run loop rom there.

        Okay here is my first paging script, the thing is that i trying to learn how..

        <? 
        include ("../../management/connectdb/mysqlcondbrr.php");
        
        $page = isset($_GET['page']) ? intval($_GET['page']) : 0;
        
        $view_pages = 10;       
        $limit_total_pages =50; $select_total_pages = " * FROM reg_info ORDER BY regdate DESC LIMIT $limit_total_pages"; $query = mysql_query("SELECT $select_total_pages "); $pages = mysql_num_rows($query); $start_page = ($page * $view_pages); $total_pages = ceil($pages / $view_pages); if ($total_pages >= 1){ $list_start = $_GET['page'] + 1; }else{ $list_start = 0; } $list_total = $total_pages - 1; $result = mysql_query("SELECT * FROM reg_info ORDER BY regdate DESC LIMIT $start_page, $view_pages"); echo '<center>' .$list_start. ' of '. $total_pages .' pages</center>'; echo '<center>'. mysql_num_rows($result)." listed users per page. </center>"; while ($row = mysql_fetch_array($result)) { echo $row['username']; } echo '<br><center>'; if ($page > 0) { echo "<a href=\"{$_SERVER['PHP_SELF']}?type=".$_GET['type']."&page=".($page-1)."\">[<<]</a>\n"; } else{ echo "[<<]\n"; } echo ' || '; if ($page < $list_total) { echo "<a href=\"{$_SERVER['PHP_SELF']}?type=".$_GET['type']."&page=".($page+1)."\">[>>]</a>\n"; } else{ echo "[>>]\n"; } echo '</center>'; echo "<br>\n"; ?>
          Write a Reply...