我通过关键字从一张表中过滤出符合条件的记录后显示在列表中,当超过15条记录就要分页显示
查询后(超过15条记录),第一页显示的是正常的
"
共有 32 条记录 |
共 3 页 |
现在是第 1 页 |
但我,跳转到下一页时,就变成了
共有 491 条记录 |
共 33 页 |
现在是第 2 页 |
也就是说,变成了没有过滤的全部记录,我把这个文件的脚本全部贴上了,有谁知道,告诉我一下呀,感激不尽!
<!--#include file="conn1.asp"-->
<!--#include file="config.asp"-->
<%
dim rs,sql,i,tj,class1,class2,cnmai,diqu
set rs=server.createobject("ADODB.recordset")
key=request("keyword")
if request("page")="" then
ThisPage=1
else
ThisPage=request("page")
end if
%>
<HTML><HEAD><TITLE><%=title%>-全部信息</TITLE>
<link href="inc_style.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY topMargin=0>
<!--#include file="index_top.asp" -->
<!--#include file=bar.asp-->
<div align="center">
<table width="760" bgcolor="#FFFFFF" style="padding:0; ">
<tr><td width="200" valign="top" bgcolor="#F5F9E3">
<td valign="top" width="560">
<table width="100%" id="table1" height="97">
<tr>
<td height="24" class=td2_muen bgcolor="#62AFFD" >
搜索关键字:<font color="#00FF00"><%=key%></font></td>
</tr>
<tr>
<td height="75" valign="top" width="597" colspan="2">
<div align="center">
<table border="1" width="100%" id="table1" cellspacing="1" bordercolor="#F2F2F2" style="border-collapse: collapse">
<tr>
<td style="width: 51; background-color:#F0E9C8" align="middle" height="25">方式</td>
<td style="width: 249px; background-color:#F0E9C8" align="middle" height="25">
标题/简介 <font color="#008080">(<img border="0" src="images/num/pic.gif" width="13" height="13">-图片
<img border="0" src="images/num/jsq.gif" width="12" height="12">-置顶
<img border="0" src="images/num/jian.gif" width="15" height="15">-推荐)</font></td>
<td style="width: 70px; background-color:#F0E9C8" align="middle" height="25">
地区</td>
<td style="width: 50px; background-color:#F0E9C8" align="middle" height="25">
价格</td>
<td style="width: 80px; background-color:#F0E9C8" align="middle" height="25">
击/回</td>
<td style="width: 65px; background-color:#F0E9C8" align="middle" height="25">日期</td>
</tr>
<%
dim ThisPage,Pagesize,Allrecord,Allpage,leixing
tj=0
sql = "select * from xinxi where biaoti like '%"&key&"%' order by id desc"
rs.open sql,conn,3,1,1
rs.Pagesize=15
Pagesize=rs.Pagesize
Allrecord=rs.Recordcount
Allpage=rs.Pagecount
if ThisPage<1 then
ThisPage=1
end if
On Error Resume Next
rs.move (ThisPage-1)*Pagesize
if rs.eof then
response.write "还没有添加信息!"
else
do while not rs.eof
response.write "<tr>"
response.write "<td style=""BACKGROUND-COLOR: #F3F3F3"" align=""middle"" width=""60"" height=""22"">"
Select Case rs("leixing")
Case "1"
response.write "<font color=""#800000"">"&leixing1&"</font>"
Case "2"
response.write "<font color=""#FF00FF"">"&leixing2&"</font>"
Case "3"
response.write "<font color=""#008000"">"&leixing3&"</font>"
Case "4"
response.write "<font color=""#FF6600"">"&leixing4&"</font>"
Case "5"
response.write "<font color=""#ff0000"">"&leixing5&"</font>"
Case "6"
response.write "<font color=""#000080"">"&leixing6&"</font>"
Case "7"
response.write "<font color=""#0000FF"">"&leixing7&"</font>"
Case "8"
response.write "<font color=""#008080"">"&leixing8&"</font>"
Case Else
response.write "<font color=""#000000"">"&leixing9&"</font>"
End Select
response.write "</td>"
response.write "<td style=""BACKGROUND-COLOR: #F3F3F3"" align=""left"" width=""342"" height=""22"">"
if rs("tupian")<>"0" then
response.write "<img src=""images/num/pic.gif"" alt=""有图片"">"
end if
response.write "<a target=""_blank"" title="""&rs("name")&"-发布于"&datevalue(rs("fbsj"))&""" href=xinximemo.asp?cnmai="&rs("id")&">"
response.write ""&rs("biaoti")&""
response.write "</a>"
response.write "</td>"
response.write "<td style=""BACKGROUND-COLOR: #F3F3F3"" align=""middle"" width=""80"" height=""22"">"&rs("diqu")&"</td>"
response.write "<td style=""BACKGROUND-COLOR: #F3F3F3"" align=""middle"" width=""40"" height=""22"">"
if rs("jiage")=0 then
response.write "面 议"
else
response.write rs("jiage")
end if
response.write "</td>"
response.write "<td style=""BACKGROUND-COLOR: #F3F3F3"" align=""middle"" width=""50"" height=""22"">"&rs("llcs")&"/"&rs("hfcs")&"</td>"
response.write "<td style=""BACKGROUND-COLOR: #F3F3F3"" align=""middle"" width=""80"" height=""22"">"&datevalue(rs("fbsj"))&"</td></tr>"
response.write "<tr><td width=""60""></td><td colspan=5 height=""22"">"&mid(rs("memo"),1,90)&"</td></tr>"
response.write "<tr><td background=""images/dotbar.gif"" height=""6"" colspan=6></td></tr>"
tj=tj+1
rs.movenext
if tj>=Pagesize then exit do
loop
end if
rs.close
set rs=nothing
%>
</table>
</div>
<div align="center">
<center>
<table border="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111" width="552" bgcolor="#F2F2F2">
<tr>
<td height="25" width="151">
<p align="center">
共有 <font color="#CC5200"><%=Allrecord%></font> 条记录</td>
<td height="25" width="126">
<p align="center">共 <font color="#CC5200"><%=Allpage%></font> 页</td>
<td height="25" width="118">
<p align="center">现在是第
<font color="#CC5200"><%=ThisPage%></font> 页</td>
<td height="25" width="157">
<p align="center">
<%
if ThisPage<2 then
response.write "<font color=""#808080"">首页</font> "
response.write "<font color=""#808080"">上一页</font> "
else
response.write "<a href=?page=1&class1="&class1&"&class2="&class2&"&cnmai="&cnmai&">首页</a> "
response.write "<a href=?page="&ThisPage-1&"&class1="&class1&"&class2="&class2&"&cnmai="&cnmai&">上一页</a> "
end if
if Allpage-ThisPage<1 then
response.write "<font color=""#808080"">下一页</font> "
response.write "<font color=""#808080"">尾页</font> "
else
response.write "<a href=?page="&(ThisPage+1)&"&class1="&class1&"&class2="&class2&"&cnmai="&cnmai&">下一页</a> "
response.write "<a href=?page="&Allpage&"&class1="&class1&"&class2="&class2&"&cnmai="&cnmai&">尾页</a> "
end if
%></td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</table>
</div><!--#include file="index_down.asp" -->
</BODY></HTML>
<%
closedb
%>