lichangcheng
(lichangcheng)
注册会员

初级会员
UID 66518
精华
0
积分 118
帖子 61
金钱 118 喜悦币
威望 0
人脉 0
阅读权限 20
注册 2005-9-9
状态 离线
|
本人根据asp写出php分页代码!简单容懂.并有演示~!并带跳转功能!非常实用!
本人根据asp写出php分页代码!简单容懂.并有演示~!当到11页时并自动向前滚动!
代码如下
<? session_start();
if ($_SESSION['mingzi']=="")
{ echo "<script>location='index.php';</script>";
exit;
}
include("conn.php");
$str="select count(*) from wangzhan";
$result=mysql_query($str);
list($count)=mysql_fetch_row($result);
$page=$_REQUEST["page"];
if ($page=="" or $page==0)
$page=1;
else {
$page=$_REQUEST["page"];}
$max=1;
$be=($page-1)*$max;
$a=ceil($count/1);?>
<html>
<head><script language="JavaScript">
function openWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用户管理列表</title>
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
.u1 {
border-top: 1px solid #D6D3CE;
border-right: 1px solid #D6D3CE;
border-bottom: 1px solid #D6D3CE;
border-left: 1px solid #D6D3CE;
height: 12px;
font-size: 12px;
}
.u2 {
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: none;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: none;
border-top-color: #D6D3CE;
border-right-color: #D6D3CE;
border-bottom-color: #D6D3CE;
border-left-color: #D6D3CE;
}
.u3 {
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: none;
border-right-style: none;
border-bottom-style: solid;
border-left-style: none;
border-top-color: #D6D3CE;
border-right-color: #D6D3CE;
border-bottom-color: #D6D3CE;
border-left-color: #D6D3CE;
}
.u4 {
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: none;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: none;
border-top-color: #D6D3CE;
border-right-color: #D6D3CE;
border-bottom-color: #D6D3CE;
border-left-color: #D6D3CE;
}
.kuang {
height: 12px;
border: 1px solid #000000;
font-family: "宋体";
font-size: 12px;
color: #330000;
font-style: normal;
float: none;
}
-->
</style></head>
<body>
<table width="516" border="0" align="center" cellpadding="0" cellspacing="0" class="u1">
<? $link="select * from wangzhan limit $be,$max;";
$sql=mysql_query($link);
$total=mysql_num_rows($sql);?><tr>
<th height="17" class="u2">ID</th>
<th class="u2">公司网址</th>
<th class="u2">详细信息</th>
<th class="u2">修改</th>
<th class="u3">删除 </th>
</tr><?
if ($total==0) {
echo "暂无纪录";
}
else
{
while($rs=mysql_fetch_array($sql))
{?>
<tr align="center" class="u4">
<td class="u4"><? echo $rs["id"];?></td>
<td class="u4"><a href=<? echo $rs["url"];?> target="_blank"><? echo $rs["url"];?></a></td>
<td class="u4">详细信息</td>
<td class="u4"><a href="webxiugai.php?id=<? echo $rs["id"];?>">修改</a></td>
<td class="u3"><a href="web_del.php?id=<? echo $rs["id"];?>">删除</a></td>
<? }
?>
</tr>
</table>
<br><form name="form1" method="get" action="weblist.php"><table width="84%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="71%" height="21" align="right">[<a href=weblist.php?page=1>首页</a>]
<?
if ($page>1)
{
echo "<a href=weblist.php?page=".($page-1) .">前一页</a> ";
}
else
{
echo"前一页 ";
}
if ($page<=$a-5)
{
$start=$page-5;
}
else
{
$start=$a-10;
}
if ($start<=0)
{ $start=1;}
for ($i=$start;$i<=$a;$i++)
{ if ($i==$page)
{echo" ".$i;}
elseif ($i<$start+11)
{echo" <a href=weblist.php?page=".$i .">".$i ."</a>";}
else
{break;}
}
if ($page<$a)
{
echo " <a href=weblist.php?page=".($page+1) .">下一页</a>";
}
else
{ echo" 下一页";}
?> [<a href=weblist.php?page=<? echo $a;?>>尾页</a>]
当前共<? echo $a?>页 现在位置:<? echo $page;?>/<? echo $a ?>页 </td>
<td width="15%" align="center">
<select name="page" size="1" class="kuang" onChange="javascript:submit()">
<? for($i=1;$i<=$a;$i++)
{?>
<option value="<? echo $i;?>" <? if ($i==$page) echo "selected"?> > 第<? echo $i;?>页 </option>
<? }?>
</select> </td>
<td width="14%" align="left"> </td>
</tr>
</table>
</form>
<? } ?>
</body>
</html>
演示地址:
http://greatwall851.3j2.net/index.php
用户:123456
密码:123456
这是本人根据asp编写的一套系统
里面集成了功能强大的在线编辑器eweb在线编辑器
但是zend加密了,虽然这样,却不影响使用
另外跪求上传代码
我的上传代码有些问题
谢谢!
[ 本帖最后由 lichangcheng 于 2006-7-20 10:20 AM 编辑 ]
|
|