搜索拦代码
<table width="329" border='0' align='right' cellpadding='0' cellspacing='0'>
<form method=post action="search.asp">
<tr align="right">
<td width="246" valign='middle'><input type='text' name='keyword' id="keyword" value="请输入关键字" size='12' >
<select name='adprofession'>
<option value=''selected>行业类别</option>
<% set rs=server.createobject("adodb.recordset")
sql="select * from adprofession order by adprofession desc"
rs.open sql,conn,3,3
do while not rs.eof %>
<option value="<%=rs("adprofession")%>"><%=trim(rs("adprofessionname"))%></option>
<%rs.movenext
loop
rs.close
%>
</select>
<select name='adinplace'>
<option value='' selected>地区</option>
<% set rs=server.createobject("adodb.recordset")
sql="select * from adinplace order by adinplace desc"
rs.open sql,conn,3,3
do while not rs.eof %>
<option value="<%=rs("adinplace")%>"><%=trim(rs("adinplacename"))%></option>
<%rs.movenext
loop
rs.close
%>
</select> </td>
<td width='83' valign='bottom' >
<input name="image" type=image src='pic/search.jpg' align="middle" width=82 /> </td>
</tr>
</form>
</table>
search.asp程序主要搜索代码如下:
<% on error resume next
dim page,keyword,cid2,cid1
page=request.querystring("page")
if page="" then page=1
if not(isnumeric(page)) then page=1
if page<1 then page=1
page=int(page)
if request("sql")<>"" then
sql=request("sql")
else
keyword=trim(request("keyword"))
adinplace=request("adinplace")
adprofession=request("adprofession")
set function1=request("function1")
if keyword<>"" then
sql="select * from adtable where adname like '%"&keyword&"%'"
end if
if adinplace<>"" then
sql=sql&" and adinplace='"&cstr(adinplace) & "'"
end if
if adprofession<>"" then
sql=sql&" and adprofession='"&cstr(adprofession)&"'"
end if
end if
rs.open sql,conn,3,3
if rs.eof then
response.write "<br>无相关商品"
rs.close
else
rs.pagesize=10
totalrec=rs.recordcount
totalpage=rs.pagecount
if page>totalpage then page=totalpage
rs.absolutepage=page
rs.cachesize=rs.pagesize
i=0
dim id(),adname(),adplace(),adtel(),adurl(),adphopo(),adprofession(),adinplace(),adintroduction()
do while not rs.eof and (i<rs.pagesize)
i=i+1
redim preserve id(i),adname(i),adplace(i),adtel(i),adurl(i),adphopo(i),adprofession(i),adinplace(i),adintroduction(i)
id(i)=rs("id")
adname(i)=rs("adname")
adplace(i)=rs("adplace")
adtel(i)=rs("adtel")
adurl(i)=rs("adurl")
adphopo(i))=rs("adphopo")
adprofession(i)=rs("adprofession")
adinplace(i),)=rs("adinplace")
adintroduction(i)=rs("adintroduction")
rs.movenext
loop
rs.close
%>
怎么搜索不了?高手帮忙解决一下,谢谢.
关于搜索记录的求助