5173卖手游账号快吗:求助,搜索的分页问题

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/30 00:18:11
<%
'======================================也属于分页显示程序的一部分=====================
const MaxPerPage=30 '每页显示多少条
dim totalPut
dim CurrentPage
dim TotalPages
dim a,j

if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
'======================================================================================
%>
<%
kujeo=request.form("kujeo")
set rs=server.createobject("adodb.recordset")
sql="select id,name from kujeo_user where kujeo='" &kujeo& "' order by id desc"
rs.open sql,conn,1,1
%>
<% '如果记录不为空的情况下输出
'====================分页显示程序========================
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage=totalPut \ MaxPerPage
else
currentpage=totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"index.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"index.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"index.asp"
end if
end if
rs.close
set rs=nothing
conn.close
set conn=nothing

sub showContent
do while not rs.eof
%>
记录:<%=rs("id")%>和<% =rs("name") %><br>
<%
a=a+1
if a>=MaxPerPage then exit do
rs.movenext
loop
end sub
%>
<%
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n=totalnumber \ maxperpage
else
n=totalnumber \ maxperpage + 1
end if
%>
<table width="770" height="25" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><form name="form1" method="post" action="<%=filename%>" style="margin-bottom:0;margin-top:0">
<% if CurrentPage<2 then %>
<font color="#b9b9b9" style="font-family: 宋体; font-size: 9pt">首页 上一页</font>
<% else %>
<a class=class href="<%=filename%>?page=1">首页</a>
<a class=class href="<%=filename%>?page=<%=CurrentPage-1%>">上一页</a>
<% end if %>
<% if n-currentpage<1 then %>
<font color="#b9b9b9" style="font-family: 宋体; font-size: 9pt">下一页 尾页</font>
<% else %>
<a class=class href="<%=filename%>?page=<%=CurrentPage+1%>">下一页</a>
<a class=class href="<%=filename%>?page=<%=n%>">尾页</a>
<% end if %>

</td>
</tr>
</table>
<%end function%>

说明:这个程序通过表单提交的kujeo值作为关键字,然后搜索数据库进行分页显示,但是显示结果能分页,可当我点下一页时,就找不到记录了。
也就是说关键字kujeo值丢失了。怎么样才能让搜索也能分页显示呢?