1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

牛人们,来救救我吧

本帖由 weifanglin2006-07-10 发布。版面名称:新人报道

  1. weifanglin

    weifanglin New Member

    注册:
    2006-05-25
    帖子:
    19
    赞:
    0
    我的网站www.ershou027.com
    检索功能是改的别人的,发现检索的时候只能显示第一页,点下一页就显示不正常了----显示的不是检索内容而是全部内容(效果请进网站在最上面有个检索框,随便输入个名词如“电脑”检索)。请各位牛人帮我支招,小生感激不尽。以下是部分关键代码(问题应该是出现在最下面的“上一页”“下一页”那连接上):

    <!--#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>武汉2手网-信息检索结果</TITLE></HEAD><BODY bgColor=#cccccc topMargin=0><!--#include file="top.asp" -->

    <div align="center">
    <table width="760" border="0" bgcolor="#FFFFFF">
    <tr>

    <td width="580" valign="top">

    <table width="100%" id="table1" border="0" cellpadding="0" cellspacing="1" bgcolor="#111111">
    <tr style="FONT-WEIGHT: bold; BORDER-LEFT-COLOR: #2E99CC; BORDER-BOTTOM-COLOR: #2E99CC; BORDER-TOP-COLOR: #2E99CC; BACKGROUND-COLOR: #2E99CC; BORDER-RIGHT-COLOR: #2E99CC" align="middle">
    <td style="width: 100%; background-color:#efefef" align="left" bordercolor="#fbfbfb" colspan="5" height="1">搜索关键字:<font color="##FF0000"><%=key%></font> </td>
    </tr>
    <tr style="FONT-WEIGHT: bold; BORDER-LEFT-COLOR: #2E99CC; BORDER-BOTTOM-COLOR: #2E99CC; BORDER-TOP-COLOR: #2E99CC; BACKGROUND-COLOR: #2E99CC; BORDER-RIGHT-COLOR: #2E99CC" align="middle">
    <td width="58" height="26" bgcolor="f1f1f1"><font color="#555555">方式</font></td>
    <td width="340" height="26" bgcolor="f1f1f1"><font color="#555555">信息标题</font></td>
    <td width="40" height="26" bgcolor="f1f1f1">
    <p><font color="#555555">价格</font></td>
    <td width="50" height="26" bgcolor="f1f1f1"><font color="#555555">点/回</font></td>
    <td width="86" height="26" bgcolor="f1f1f1"><font color="#555555">发布日期</font></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,1,1
    rs.Pagesize=20
    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"">"
    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=""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>"
    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 width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#f1f1f1">
    <tr><td height="25" width="181"><a href="addxinxi.asp"><font color="#FF0000">【发布信息】</font></a>共有<font color="#CC5200"><%=Allrecord%></font>条记录</td><td height="25" width="96"><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>&nbsp;"
    response.write "<font color=""#808080"">上一页</font>&nbsp;"
    else
    response.write "<a href=?page=1&class1="&class1&"&class2="&class2&"&cnmai="&cnmai&">首页</a>&nbsp;"
    response.write "<a href=?page="&ThisPage-1&"&class1="&class1&"&class2="&class2&"&cnmai="&cnmai&">上一页</a>&nbsp;"
    end if
    if Allpage-ThisPage<1 then
    response.write "<font color=""#808080"">下一页</font>&nbsp;"
    response.write "<font color=""#808080"">尾页</font>&nbsp;"
    else
    response.write "<a href=?page="&(ThisPage+1)&"&class1="&class1&"&class2="&class2&"&cnmai="&cnmai&">下一页</a>&nbsp;"
    response.write "<a href=?page="&Allpage&"&class1="&class1&"&class2="&class2&"&cnmai="&cnmai&">尾页</a>&nbsp;"
    end if
    %></td></tr></table></center></div></td></tr></table></table></div>

    <!--#include file="end.htm" -->
    </BODY>
    </HTML>


    本帖子不是广告,请不要误会,我这是面向武汉的网站,向各位站长宣传也没什么用。
     
  2. weifanglin

    weifanglin New Member

    注册:
    2006-05-25
    帖子:
    19
    赞:
    0
    顶,没人帮忙啊?
     
  3. yeshou

    yeshou New Member

    注册:
    2005-09-06
    帖子:
    7,067
    赞:
    34
    路过 帮顶
     
  4. lonely

    lonely New Member

    注册:
    2005-12-08
    帖子:
    685
    赞:
    11
    只会PHP,不懂ASP:mummy:
     
  5. 不学无术

    不学无术 Ulysses 的元神

    注册:
    2005-08-31
    帖子:
    16,714
    赞:
    39
    原因很简单,SQL 语句中需要 key 变量,除了第一页,你如何保证其它页这个变量有内容?
     
  6. weifanglin

    weifanglin New Member

    注册:
    2006-05-25
    帖子:
    19
    赞:
    0
    那应该怎么破这个问题啊?~~~~~~~跪求!
     
  7. 小四

    小四 New Member

    注册:
    2005-09-08
    帖子:
    82
    赞:
    1
    你在获得request("page")后为什么重新dim了thispage?
     
  8. 小四

    小四 New Member

    注册:
    2005-09-08
    帖子:
    82
    赞:
    1
    还有,你的条件都没有继承
     
  9. weifanglin

    weifanglin New Member

    注册:
    2006-05-25
    帖子:
    19
    赞:
    0
    搞定,谢谢楼上几位的指点!