日期:2014-05-17  浏览次数:20402 次

PHP分页求助,有代码帮看一下.点击分页获取值失效了在线等....大大帮忙
<?php 

$conn=mysql_connect("localhost","root","toma123") or die("连接错误");
mysql_select_db("cs",$conn);
mysql_query("set names 'GBK'");
mysql_query("set characher set gb2312");
mysql_query("set names gb2312");



$tt=$_GET['tt'];



if($Submit){
$sql="select * from ud8 where sessionm = '$tt'";
echo $sql;

$result=mysql_query($sql) or die ("$sql");

$sst=mysql_fetch_array($result);

$num=mysql_num_rows($result); //统计行数

$pages=ceil($num/5); //总页数

$page=$_GET['page']; //获得page,如果没有设置或者page=0,把$page=1;

if($page=="")
{  
$page=1;  
 
}

$start=($page-1)*5;

$sql="select * from ud8 where sessionm like '%$tt%' limit ".$start.",". 5 ;


$query=mysql_query($sql) or die($sql);

?>

<?php

while($sumpage=mysql_fetch_array($query))
{
$XX="<img src=\"".$sumpage['TP']."\" hight=\"300\" width=\"182\" / >";

$id=$sumpage['id'];  

?>

<table width="965" height="50">
<tr>
<td width="180" height="22" bgcolor="#f0f0f0"><div align="center">公司名称</div></td>
<td width="238" height="22" bgcolor="#f0f0f0"><div align="center">图片缩略图</div></td>
<td width="321" height="22" bgcolor="#f0f0f0"><div align="center">简介</div></td>
<td width="221" height="22" bgcolor="#f0f0f0"><div align="center">操作</div></td>
</tr>
<tr>
<td width="165" height="12"><div align="center"><?php echo $sumpage['title']; ?> </div></td>
<td height="12"><div align="center"><?php echo $XX;?>
</div></td>
<td width="321" height="12"><div align="center"><?php echo $sumpage['conne'] ?></div></td>
<td width="221" height="12"><div align="center" class="STYLE1"><a href="del.php?id=<?php echo $id ?>">删除</a></div></td>
</tr>
<tr></tr>
</table>
 
<?php 


}



if($num!=0)
{
if($page!=1)
{

"<a href=?page=1>首页</a>";
}else 
{
"首页\t";  
}
if($page>1)
{
"<a href=?page=".($page-1).">上一页</a>\t";
}else
{
"上一页\t";
}  
if($page<$pages)
{
"<a href=?page=".($page+1).">下一页</a>\t";
}else 
{
"下一页\t";
}  
if($page!=$pages )
{
"<a href=?page=".$pages.">尾页</a>\t";


}else 
{
"尾页\t";
}
}else 
{
"目前没有记录!!";
}

}

?> 
  
  

<table width="40%" border="0" align="center">