高手来帮我看看这段模糊搜索代码的问题吧~~
<%dimselect1,contentcontent=trim(request.Form("name"))select1=int(request.Form("selec...
<%dim select1,content
content=trim(request.Form("name"))
select1=int(request.Form("select"))
if select1="" then
select1=83
end if
if content="" then
Response.Write("<script>alert('搜索内容不能为空');history.go(-1)</script>")
response.End()
end if
dim rs100
Dim str
Set rs100=Server.CreateObject("ADODB.Recordset")
str="Select * from shop_product where btype_id="&select1&" and productname like '%"&content&"%'"
rs100.open str,conn,1,1
%>
这段代码要达到的作用是在选定的btype_id类型下,输入关键字,进行模糊查询!但我测试后,发现输入关键字后,只能出现一个结果,而事实上包含关键字的结果不止一个的,请各位帮忙看看这段代码里有没有什么问题,或者可能其他地方会有的问题?
http://hi.baidu.com/ingrid_ca/blog/item/23cd53dab86293ddb6fd48dd.html
这是全部的代码. 展开
content=trim(request.Form("name"))
select1=int(request.Form("select"))
if select1="" then
select1=83
end if
if content="" then
Response.Write("<script>alert('搜索内容不能为空');history.go(-1)</script>")
response.End()
end if
dim rs100
Dim str
Set rs100=Server.CreateObject("ADODB.Recordset")
str="Select * from shop_product where btype_id="&select1&" and productname like '%"&content&"%'"
rs100.open str,conn,1,1
%>
这段代码要达到的作用是在选定的btype_id类型下,输入关键字,进行模糊查询!但我测试后,发现输入关键字后,只能出现一个结果,而事实上包含关键字的结果不止一个的,请各位帮忙看看这段代码里有没有什么问题,或者可能其他地方会有的问题?
http://hi.baidu.com/ingrid_ca/blog/item/23cd53dab86293ddb6fd48dd.html
这是全部的代码. 展开
2个回答
展开全部
没有做循环,显示出来的当然只有一个了。
<!--#include file="conn/conn1.asp"-->
<!--#include file="conn/webconfig.asp"-->
<html><head>
<%dim select1,content
content=trim(request.Form("name"))
select1=int(request.Form("select"))
if select1="" then
select1=83
end if
if content="" then
Response.Write("<script>alert('搜索内容不能为空');history.go(-1)</script>")
response.End()
end if
dim rs100
Dim str
Set rs100=Server.CreateObject("ADODB.Recordset")
str="Select * from shop_product where productname like '%"&content&"%'"
rs100.open str,conn,1,1
%>
<title><%=anclassname%>|<%=webname%></title>
<meta name="description" content="<%=anclassname%>,<%=webname%>">
<meta name="keywords" content="<%=anclassname%>,<%=webname%>">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="img/css.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="../images/bg.jpg">
<!--#include file="webtop.asp"-->
<table width="952" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="898"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="200" valign="top"><table width="98%" border="0" cellspacing="0" cellpadding="0">
<TD vAlign=top class=b><!--#include file="info/info_fenlei.asp"--></TD>
</TR>
<TR>
<TD vAlign=top class=b><!--#include file="info/info_news.asp"--></TD>
</TR>
<TR> </table>
<td width="14" background="img/xiao/bg_body.gif"></td>
<td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="10" height="5" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10"></td>
</tr>
</table></td>
</tr>
</table>
<!--#include file="info/info_leitop.asp"--> <table width="98%" height="5" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="22%" height="32" valign="bottom"><img src="img/xiao/CPXIZL.gif" width="151" height="21"></td>
</tr>
<tr>
<td height="1"background="img/xiao/linedot.gif"></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td width="100%"><%if rs100.eof then%>暂无相关信息<%else%><br> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<%for i=1 to rs100.recordcount%>
<td width="25%" height="134" align="left" bgcolor="#FFFFFF">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><TABLE width=100 height=100 border=0 align="center" cellPadding=2 cellSpacing=1 bgColor=#e1e1e1 onMouseOver="this.style.backgroundColor='#FF6600'" onMouseOut="this.style.backgroundColor=''">
<TBODY>
<TR>
<TD width=100 height=100 bgColor=#ffffff align=center>
<%if rs100("upfilepic")="" then
response.write "<div align=center><a href=product.asp?id="&rs100("productid")&" ><img src=img/emptybook.gif width=98 height=98 border=0></a></div>"
else%>
<a href=product.asp?id=<%=rs100("productid")%>><img src="<%=trim(rs100("upfilepic"))%>" alt="<%=rs100("productname")%>" width=120 height=120 border=0></a>
<%end if%>
</td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align=center><%=trim(rs100("productname"))%><br>
会员价:<font color=#FF3300><%=trim(rs100("huiyuanjia"))%>
元</font> </td>
</tr>
</table></td>
</tr>
</table></td>
<%
if i mod 4=0 then response.Write("</tr><tr>")
rs100.movenext
next
%>
<%
end if
rs100.close
set rs100=nothing
%>
</tr>
</table></td>
</tr>
</table></td>
<td width="1" background="img/xiao/bgbg.gif"></td>
</tr>
</table></td>
</tr>
</table>
<!--#include file="copyright.asp" -->
</body>
</html>
<!--#include file="conn/conn1.asp"-->
<!--#include file="conn/webconfig.asp"-->
<html><head>
<%dim select1,content
content=trim(request.Form("name"))
select1=int(request.Form("select"))
if select1="" then
select1=83
end if
if content="" then
Response.Write("<script>alert('搜索内容不能为空');history.go(-1)</script>")
response.End()
end if
dim rs100
Dim str
Set rs100=Server.CreateObject("ADODB.Recordset")
str="Select * from shop_product where productname like '%"&content&"%'"
rs100.open str,conn,1,1
%>
<title><%=anclassname%>|<%=webname%></title>
<meta name="description" content="<%=anclassname%>,<%=webname%>">
<meta name="keywords" content="<%=anclassname%>,<%=webname%>">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="img/css.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="../images/bg.jpg">
<!--#include file="webtop.asp"-->
<table width="952" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="898"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="200" valign="top"><table width="98%" border="0" cellspacing="0" cellpadding="0">
<TD vAlign=top class=b><!--#include file="info/info_fenlei.asp"--></TD>
</TR>
<TR>
<TD vAlign=top class=b><!--#include file="info/info_news.asp"--></TD>
</TR>
<TR> </table>
<td width="14" background="img/xiao/bg_body.gif"></td>
<td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="10" height="5" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10"></td>
</tr>
</table></td>
</tr>
</table>
<!--#include file="info/info_leitop.asp"--> <table width="98%" height="5" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="22%" height="32" valign="bottom"><img src="img/xiao/CPXIZL.gif" width="151" height="21"></td>
</tr>
<tr>
<td height="1"background="img/xiao/linedot.gif"></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td width="100%"><%if rs100.eof then%>暂无相关信息<%else%><br> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<%for i=1 to rs100.recordcount%>
<td width="25%" height="134" align="left" bgcolor="#FFFFFF">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><TABLE width=100 height=100 border=0 align="center" cellPadding=2 cellSpacing=1 bgColor=#e1e1e1 onMouseOver="this.style.backgroundColor='#FF6600'" onMouseOut="this.style.backgroundColor=''">
<TBODY>
<TR>
<TD width=100 height=100 bgColor=#ffffff align=center>
<%if rs100("upfilepic")="" then
response.write "<div align=center><a href=product.asp?id="&rs100("productid")&" ><img src=img/emptybook.gif width=98 height=98 border=0></a></div>"
else%>
<a href=product.asp?id=<%=rs100("productid")%>><img src="<%=trim(rs100("upfilepic"))%>" alt="<%=rs100("productname")%>" width=120 height=120 border=0></a>
<%end if%>
</td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align=center><%=trim(rs100("productname"))%><br>
会员价:<font color=#FF3300><%=trim(rs100("huiyuanjia"))%>
元</font> </td>
</tr>
</table></td>
</tr>
</table></td>
<%
if i mod 4=0 then response.Write("</tr><tr>")
rs100.movenext
next
%>
<%
end if
rs100.close
set rs100=nothing
%>
</tr>
</table></td>
</tr>
</table></td>
<td width="1" background="img/xiao/bgbg.gif"></td>
</tr>
</table></td>
</tr>
</table>
<!--#include file="copyright.asp" -->
</body>
</html>
柚鸥ASO
2024-03-16 广告
2024-03-16 广告
「柚鸥ASO」在ASO这块就做的蛮不错的,一直专注于应用商店优化,因为专注所以专业;专注应用商店下载量优化、评分优化、关键词排名优化、关键词覆盖、产品权重提升等等整体方案优化服务柚鸥网络-全球ASO优化服务商专注ASO优化已11年!(效果说...
点击进入详情页
本回答由柚鸥ASO提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询