日期:2014-05-17 浏览次数:20716 次
<body>
<table width="502" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#666666">
<tr>
<td colspan="5" align="center" valign="middle" bgcolor="#666666"> <span class="STYLE2">栏目管理 </span> </td>
</tr>
<tr>
<td width="37" align="center" bgcolor="#FFFFFF"> <strong>编号 </strong> </td>
<td width="145" align="center" bgcolor="#FFFFFF"> <strong>栏目名称 </strong> </td>
<td width="94" align="center" bgcolor="#FFFFFF"> <strong>排序 </strong> </td>
<td width="95" align="center" bgcolor="#FFFFFF"> <strong>编辑 </strong> </td>
<td width="95" align="center" bgcolor="#FFFFFF"> <strong>删除 </strong> </td>
</tr>
<?php
//当前页数
$page = isset($_GET['page'])?intval($_GET['page']):1;
//每页记录数
$each_page = 5;
//查询留言总数
$res = mysql_query("SELECT COUNT(*) FROM wyx_class");
$total = mysql_result($res, 0);
//总页数
$total_page = ceil($total/$each_page);
//计算真实的页数,使得页数总是落在1~$total_page之间
$page = ($page <0)?1:$page;
$page = ($page>$total_page)?$total_page:$page;
//根据真实的页数值,计算偏移量
$offset = ($page-1)*$each_page;
//尾页
$lastpg=ceil($total/$each_page);
//上一页
$prestart=$page-1;
//下一页
$nextpage=$page+1;
$SQL="select * from wyx_class order by wyx_classsort asc limit $offset,$each_page";
$Result=mysql_query($SQL);
while($Row=mysql_fetch_array($Result))
{
$wyx_id=$Row["wyx_id"];
$wyx_classname=$Row["wyx_classname"];
$wyx_classsort=$Row["wyx_classsort"];
?>
<tr>
<td width="37" align="center" bgcolor="#FFFFFF"> <?php echo $wyx_id ?> </td>
<td width="145" align="center" bgcolor="#FFFFFF"> <?php echo $wyx_classname ?> </td>
<td width="94" align="center" bgcolor="#FFFFFF"> <?php echo $wyx_classsort ?> </td>
<td width="95" align="center" bgcolor="#FFFFFF"> <a href="admin_classedit.php?id= <?php
echo $wyx_id ?>">编辑 </a> </td>
<td width="95" align="center" bgcolor="#FFFFFF"> <a href="admin_classdel.php?id= <?php
echo $wyx_id ?>">删除 </a> </td>
</tr>
<?php
}
?>
<tr>
<td colspan="5" bgcolor="#FFFFFF"> </td>
</tr>
</table> <div align="center">
<?php
if($page>1){
//如果页数大于1,则激活显示“前一页”的按钮
?>
<input type="button" value=" 前一页 " onClick="location.href='?id=$id&page= <?php echo $page-1 ?>'">
<?php
}else{
//这里非激活显示“前一页”的按钮
?>
<input type="button&quo