标题:[求助]搜索问题~~为什么没人理我啊?我在一直等待
只看楼主
io5200
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-10-7
 问题点数:0 回复次数:0 
[求助]搜索问题~~为什么没人理我啊?我在一直等待

'-------------------搜索--------------------- <form name="form1" method="post" action="search.asp"> <td width="122"> 输入要搜索的内容: </td> <td width="172"> <input name="keyin" type="text" id="keyin"></td> <td width="107"><select name="title" size="1" id="title"> <option value="1" selected>全部关键字</option> <option value="2">按标题搜索</option> <option value="3">按内容搜索</option> </select></td> <td width="140"><input name="I1" type="image" class="timtd" src="../images/button-tijiao.gif" width="70" height="18" border="0"></td> </form> '------------------搜索显示代码----------- <%'开始分页 Const MaxPerPage=15 dim totalPut dim CurrentPage dim TotalPages dim j dim sql1 if Not isempty(request("page")) then currentPage=Cint(request("page")) else currentPage=1 end if

typer=trim(request("title")) keyin=trim(request("keyin")) select case typer case "1" sql1="title & content lIKE '%"&keyin&"%' " case "2" sql1="title lIKE '%"&keyin&"%' " case "3" sql1="content lIKE '%"&keyin&"%'" end select

set rs=server.CreateObject("adodb.recordset") rs.open "select * from tlt where what='我的一个条件' and "&sql1&"",conn,1,1 if rs.eof And rs.bof then Response.Write "<p align=center> 对不起,没有查讯到!</p><br>" else 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,"search.asp" else if (currentPage-1)*MaxPerPage<totalPut then rs.move (currentPage-1)*MaxPerPage showContent showpage totalput,MaxPerPage,"search.asp" else currentPage=1 showContent showpage totalput,MaxPerPage,"search.asp" end if end if end if

sub showContent dim i i=0 %> <%do while not rs.eof%> '-----------------显示---------------- <table border="0" cellspacing="0" width="100%" bordercolorlight="#000000" bordercolordark="#FFFFFF" cellpadding="0" bgcolor="#000000"> <tr bgcolor="#FFFFFF"> <td width="470" height="23">   <A href="printpage.asp?id=<%=rs("id")%>" target=_blank><%=rs("title")%></A> <font color="#cccccc">[<a href="printpage.asp?typ=<%=rs("typ")%>"><font color="#cccccc"><%=rs("typ")%></font></a>]</font></td> <td width="100">【<%=rs("date")%>】</td> </tr> <tr bgcolor="#FFFFFF"> <td colspan="2"><hr width="90%" size=1 style="border:1px dotted #038103;"></td> </tr> </table> '--------------------分页--------------- <%i=i+1 if i>=MaxPerPage then Exit Do rs.movenext loop rs.close set rs=nothing%> <% 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 Response.Write "<form method=Post action="&filename&"?keyin="&keyin&"&title="&typer&">" Response.Write "<p align='center' class='contents'> " If CurrentPage<2 Then Response.Write "<font class='contents'>首页 上一页</font> " Else Response.Write "<a href="&filename&"?page=1&keyin="&keyin&"&title="&typer&" class='contents'>首页</a> " Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&keyin="&keyin&"&title="&typer&" class='contents'>上一页</a> " End If

If n-currentpage<1 Then Response.Write "<font class='contents'>下一页 尾页</font>" Else Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&keyin="&keyin&"&title="&typer&" class='contents'>" Response.Write "下一页</a> <a href="&filename&"?page="&n&"&keyin="&keyin&"&title="&typer&" class='contents'>尾页</a>" End If Response.Write "<font class='contents'> 页次:</font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"页</font> " Response.Write "<font class='contents'> 共查讯到"&totalnumber&"条 " Response.Write "<font class='contents'>转到:</font><input CLASS='wenbenkuang' type='text' name='page' size=2 maxlength=8 class=smallInput value="&currentpage&">" Response.Write "&nbsp;<input type='submit' CLASS='go-wenbenkuang' class='contents' value='GO' name='cndok'></form>" End Function %> '---------------------------------------------------------------------------------------------- 请各位高手指点一下,为什么我的显示出来会是这个样子呢??也显示查询到的记录,但是分页的时候就显示下面的样子了,不知道为什么,是我的多条件查询写的不对,还是我的分页有毛病呢?我很菜的~~谢谢同志们拉~~ 首页 上一页 下一页 尾页 页次:1/0页 共查讯到0条 转到:

[此贴子已经被作者于2005-10-7 10:31:34编辑过]

搜索更多相关主题的帖子: 搜索 
2005-10-07 09:44



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-29474-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.124984 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved