分页源代码,分页时上一页下一页不显示,但可以跳转
<?php $key=$_REQUEST["key"]; $sql="select * from product where pronum like'%$key%' or pdes like '%$key%'";
$page=$_REQUEST["page"];
$ss=mysql_query($sql,$conn);
$row1=mysql_fetch_array($ss);
$num=$row1[0];
if($num>0)
{
if (empty($_GET['page']))
{ $page=1;}
else
{$page=$_GET['page'];}
if($page<1)$page=1;
if($page>=ceil($num/5)) $page=ceil($num/5);
$sql1="select * from product where pronum like'%$key%' or pdes like '%$key%' limit ".($page*5).",5";
//echo $sql1;
$rest1=mysql_query($sql1,$conn);
?>
<table width="100%" border="1">
<tr>
<td width="159">Product</td>
<td width="406">Description</td>
</tr>
<?php
while($row=mysql_fetch_array($rest1))
{ ?>
<tr>
<td><?php echo $row["pronum"]?></td>
<td><?php echo $row["pdes"]?></td>
</tr>
<?php }?>
</table>
<?php if($page==1)
{ ?>
<span class="STYLE7">firsPage</span>
<span class="STYLE7">PrevPage</span>
<?php
}
else
{?>
<a href="pproduct.php?page=1"><span class="STYLE7">firsPage </span></a>
<a href="pproduct.php?page=<? echo($page-1) ?>"class="STYLE7">PrevPage</a>
<? } ?>
<?php if($page==ceil($num/5))
{ ?> <span class="STYLE5">nextPage</span>
<span class="STYLE7">LastPage</span>
<?php }
else
{ ?> <a href="pproduct.php?page=<? echo ($page+1) ?>" class="STYLE5">nextPage</a>
<a href="pproduct.php?page=<?=ceil($num/5)?>">LastPage</a>
<?PHP }
}
else
{echo"<script language=javascript>alert('NO recordset');window.location.href='product.php';</script>";
} ?> </td>
<td width="7%" valign="top"><img src="images/c_2.gif" alt="evoc" width="68" height="304" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td background="images/a_27_1.gif" style="height: 44px">
<table border="0" cellpadding="0" cellspacing="0" height="40" width="100%">
<tr>
<td style="width: 9%; height: 35px">
</td>
<td align="center" style="height: 35px" valign="bottom" width="56%">
<span class="font1 STYLE5" style="color: #333333">Copyright © 1998-2008 EVOC INTELLIGENT TECHNOLOGY CO., LTD </span>
</td>
<td style="color: #333333; height: 35px" width="31%">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<img height="37" src="images/a_28.gif" width="1003" /></td>
</tr>
</table>
<script src="http://www. type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1708392-2";
urchinTracker();
</script>