搜索页面左边树型搜索结果代码 修改

本文介绍了一种动态构建分类搜索的方法,通过分析用户请求参数,如sortid和typeid来从数据库中获取相应类别的信息,并显示搜索结果数量。该方法适用于需要快速响应不同类别搜索需求的场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<%
if Chkrequest(sortid) then
sortsql="select class_2.typeid,class_2.typename,class_1.* from class_2,class_1 where class_2.sortid="&sortid&" and class_1.sortid=class_2.sortid"
set rssort=conn.execute(sortsql)
if rssort.eof then
response.write"暂无信息"
else
if Getsearchsortcount4>0 then response.write"<b><A href='searchall.asp?sortid="&sortid&"&keywords="&keywords&"'>"&rssort("sort")&"</A> ("&Getsearchsortcount4&")</b><br>"
do while not rssort.eof
response.write"<span class=lh13>"
if Getsearchtypecount4>0 then response.write"·<a href='searchall.asp?typeid="&rssort("typeid")&"&keywords="&keywords&"' class='s'>"&rssort("typename")&"</a> ("&Getsearchtypecount4&")<br>"
rssort.movenext   
loop
end if
rssort.close
set rssort=nothing


elseif Chkrequest(typeid) then
typesql="select class_2.typeid,class_2.typename,class_1.* from class_2,class_1 where class_2.typeid="&typeid&" and class_1.sortid=class_2.sortid"
set rstype=conn.execute(typesql)
if rstype.eof then
response.write"暂无信息"
else
if Getsearchsortcount5>0 then response.write"<b><A href='searchall.asp?sortid="&rstype("sortid")&"&keywords="&keywords&"'>"&rstype("sort")&"</A> ("&Getsearchsortcount5&")</b><br><span class=lh15>"
if Getsearchtypecount>0 then response.write"·<a href='searchall.asp?typeid="&rstype("typeid")&"&keywords="&keywords&"' class='s'>"&rstype("typename")&"</a> ("&Getsearchtypecount&")<br>"
end if
rstype.close
set rstype=nothing

else

sortsql="select * from class_1"  
set rssort=conn.execute(sortsql)
if rssort.eof then
response.write"暂无信息"
else
do while not rssort.eof
response.write"<span class=lh15>"
if Getsearchsortcount>0 then response.write" <b><A href='searchall.asp?sortid="&rssort("sortid")&"&keywords="&keywords&"'>"&rssort("sort")&"</A> ("&Getsearchsortcount&")</b><br>"
typesql="select * from class_2 where sortid="&rssort("sortid")&""
set rstype=conn.execute(typesql)
if rstype.eof then
response.write"暂无信息"
else
do while not rstype.eof
if Getsearchtypecount>0 then response.write"·<a href='searchall.asp?typeid="&rstype("typeid")&"&keywords="&keywords&"' class='s'>"&rstype("typename")&"</a> ("&Getsearchtypecount&")<br>"
rstype.movenext   
loop
end if
rstype.close
set rstype=nothing
rssort.movenext
loop
end if
rssort.close
set rssort=nothing
end if
%>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值