ASP分词搜索
我想做一个ASP分词搜索, 如:搜索 打印机 三星 自动,把这二个词分开,在同一个字段搜索
帮我看一下,那里有错,
代码如下:
str="1=1"
astr=""
if trim(request("keyword"))<>"输入商品名称" then
keyArr=split(keyword," ")
j=UBound(keyArr)
t=0
dim keystrArr()
for i=0 to j
if keyArr(i)<>"" then
redim preserve keystrArr(t)
strfilter="( bookname like '%"&keyArr(i)&"%' "
keystrArr(t)=strfilter
t=t+1
end if
next
keystr=join(keystrArr," and ")
str=str&" and "&keystr
end if
if int(request("areaid"))>0 then
astr=astr&" and areaid="&ReqNum("areaid")&""
end if
set rs=server.CreateObject("adodb.recordset")
rs.open"select * from shop_product where ("&str&astr&" and shengid="&request.Cookies("provinceid")&" and shiid="&request.Cookies("cityid")&") or ( "&str&" and userid=30) order by bookid desc",conn,1,1