希望朋友门帮帮忙代码如下:(search.asp)
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp" -->
<!--#include file="CHAR.INC" -->
<%
keyword=request.form("keyword")
leibie=request.form("leibie")
weizhi=request.form("weizhi")
if leibie="0" then
leibie="%"
else
leibie=leibie
end if
keyword=htmlencode(keyword)
if keyword="" then
response.write("<script>alert('搜索内容不能为空!');history.go(-1)</script>")
else
if keyword="%" or keyword="*" then
response.write("<script>alert('不要输入非法字符!');history.go(-1)</script>")
else
set rs=server.createobject("adodb.recordset")
sql="select * from main where huifu=false and leibie like " & "'" & leibie & "' and " & weizhi & " like " & "'%" & keyword & "%' order by number DESC"
rs.open sql,conn,1,3
%>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body><table width="776" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="196" bgcolor="#FFCC00"><%if rs.eof then%>
<div align="center"><font color="#FF0000">抱歉,没有找到您需要的内容</font></div>
<%else%><strong>查询结果:</strong><%
rs.PageSize=10
Page=CLng(request("Page"))
if Page<1 then Page=1
if Page>rs.PageCount then Page=rs.PageCount
rs.movefirst
rs.absolutepage=Page
do while not rs.eof
%><table>
<tr><td width="668" bgcolor="#f7efef"><a href="result.asp?id=<%=rs("id")%>" target="_blank"><%=rs("title")%></a></a></td></tr></table><br><% rs.movenext
loop end if %>
<p>
<%
if page<>1 then
response.Write "<a href=search.asp?page=1>第一页</a>"
response.Write "<a href=search.asp?page=" & (page-1) & ">上一页</a>"
end if
if page<>rs.pagecount then
response.Write "<a href=search.asp?page=" & (page+1) & ">下一页</a>"
response.Write "<a href=search.asp?page=" & rs.pagecount & ">最后一页</a>"
end if
%>
第<%=page%>页 共<%=rs.pagecount%>页</p> </td>
</tr>
</table>
</body>
</html>
<%end if
end if
%>