我做了一个分页  一个页面有5个系列的产品  都在一个表里 我加了一个type字段区分    但是我现在在2系列产品点击下一页  为什么跑到1系列的下一页了?  刚学习PHP没多久 想请教各位高手
$sql = "select * from shuzitxin where shuz_type=$type";
<tr>
<td colspan="8" align="center">
<a href="jituan2.php?type=shuz_type&page">首页</a>/
<a href="jituan2.php?type=shuz_type&page=<?=($page-1)?>">上一页</a>/
<a href="jituan2.php?type=shuz_type&page=<?=($page+1)?>">下一页</a>/
<a href="jituan2.php?type=shuz_type&page=<?=$countpage?>">尾页</a></td>
</tr>  
 是这样做吗?  请教各位~  谢谢大家,,  

解决方案 »

  1.   

    你想针对不同的系列分页?用这个type字段区分不同的系列?type=shuz_type表示第二系列吗?
      

  2.   

    恩对。 同一个页面,五个不同系列,做分页。  type=shuz_type 是的 这个是区分不同系列分页的
      

  3.   

    <?php
    $link = mysql_connect("61.129.57.211","aaa","123456");
    mysql_select_db("aaa",$link);
    mysql_query("set names utf8");

    $type=$_GET["type"];
    $sql = "select * from shuzitxin where shuz_type=$type";
    $result = mysql_query($sql) or die($sql."<br>".mysql_error());

    $count = mysql_num_rows($result); //共有几条记录 $pagecount = 5; // 每页显示几条数据 $countpage = ceil($count/$pagecount);  //共有多少页 if($_GET["page"]){
    $page = $_GET["page"];
    if($page<0){$page = 1;}
    if($page>$countpage){$page = $countpage;}
    }else{
    $page = 1;}
    $span = ($page-1)*$pagecount;
    $sql_1 = $sql." limit $span,$pagecount";
    $result_1 = mysql_query($sql_1) or die(mysql_error());
    if($count>0){?>
          <table>
      
                                
    <?php
       while($rs = mysql_fetch_array($result_1)){
     
    ?>
                    <tr>
                      <td width="200" align="center" valign="middle"><a href="jituan3.php?ID=<?=$rs["shuz_ID"]?>"><img src="imagess/<?=$rs["shuz_Path"]?>" style="height:100px" width="100px"/></a></td>
                    <td class="chanpin"><p><strong>产品名称:</strong><a href="jituan3.php?ID=<?=$rs["shuz_ID"]?>"><?=$rs["shuz_Name"]?></a> <br />
                              <strong>产品编号:</strong><a href="jituan3.php?ID=<?=$rs["shuz_ID"]?>"><?=$rs["shuz_LeiX"]?></a><br />
                            <strong>产品类别:</strong><a href="jituan3.php?ID=<?=$rs["shuz_ID"]?>"><?=$rs["gejiab_type "]?></a></p></td>
                    </tr>
                    <?
       }}
    ?><tr>
    <td colspan="8" align="center">
    <a href="jituan2.php?type=shuz_type&page">首页</a>/
    <a href="jituan2.php?type=shuz_type&page=<?=($page-1)?>">上一页</a>/
    <a href="jituan2.php?type=shuz_type&page=<?=($page+1)?>">下一页</a>/
    <a href="jituan2.php?type=shuz_type&page=<?=$countpage?>">尾页</a></td>
    </tr>
                    </table>这是源码!  有些乱
      

  4.   

    把type跟过去,然后正确的接收,我保准你的程序不会出错。
      

  5.   

    如果到了第一个系列,那你看看URL上面的type是什么。你就会明白了。至于为什么会这样,你就找找前面列出的链接里面type是什么。
      

  6.   

    <a href="jituan3.php?ID= <?=$rs["shuz_ID"]?>"> <?=$rs["gejiab_type "]?> 你这里连type都没有带
      

  7.   

    <a href="jituan3.php?ID= <?=$rs["shuz_ID"]?>"> <?=$rs["gejiab_type "]?>   这个和分页不是同一个 这里是连接3页面的 3页面没有分页,     这样做分页与上级页面有没有关联呢?  我太新手了。  不太明白。
    jituan2.php?page=2$type=shuz_type每个系列的URL都是这个
     
      

  8.   

    type跟过去?  跟到哪里?  不太明白
      

  9.   

    是不是  href="jituan2.php?type=shuz_type&pagetype=shuz_type需要动态生成的?  
      

  10.   

    <a href="jituan2.php?type=<?=$type?>&page">首页 </a>改这个值改成动态的就行了