我做了一个分页 一个页面有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>
是这样做吗? 请教各位~ 谢谢大家,,
$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>
是这样做吗? 请教各位~ 谢谢大家,,
$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>这是源码! 有些乱
jituan2.php?page=2$type=shuz_type每个系列的URL都是这个