为什么当我点击其他链接时计数器重置


Why counter resets when I click on other link?

我在while loop中定义了一个counter,它在循环外初始化。

我有echoloop本身的计数器。当我在第一页上有50条记录时,它显示1到25。问题是,在第二页,它又从1开始,不像它应该工作:从26开始到50。

下面是我的代码:
        <?php
        //show records
        $query = mysqli_query($con,"SELECT table2.col2 AS a,table1.col2 AS   b, table1.col1 AS c, table1.q_url AS d FROM {$statement} LIMIT {$startpoint} ,   {$limit}");
        $Authorname='';
        $count=1;
        while ($row = mysqli_fetch_array($query)) {

        $output='';
        $Authorname =$row['a'];
          $url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
          $url=explode('/',$url);
          ?>
        <div class="record round"><?php echo  $count;$output .='<a     href="http://localhost/quotes/'.$url[5].'/'.$row['d'].'.html">';
         echo $output .=$row['b'].'</a>';?></div>
          <?php 
          $count++; 
        }
        ?> 

编辑试着

$nbpage = 2;
$nbresultperpage=25;
$count = ($nbpage-1)*$nbresultperpage;

其中$nbpage是你当前的页码