在英文网站中,模糊搜索的代码总是不正确,请高手看一下,谢谢!
我在中文版网站中加了%符号就能达到模糊搜索的效果,可是到同样的英文网站,我加上%符号就不起作用了,请高手帮忙看一下,我哪里出了问题,谢谢!附英文网站代码
<%
dim i,intPage,page,pre,last,filepath,linkadd
set rsp = server.createobject("adodb.recordset")
pid1=cint(trim(request("id1")))
pid2=cint(trim(request("id2")))
if session("Upass")="" then
if keywords="" then
if pid1<>"" then
if pid2="" then
pid3=pid1
else
pid3=pid1&"-"&pid2
end if
productsSQL= "select * from products where lputout=true and LNewProduct=false and (LSort = '"&pid3&"' or LSort like '"&pid3&"-%') order by LCommend,LPrice,id desc"
if pid2<>"" then
productsSQL= "select * from products where lputout=true and LNewProduct=false and LSort = '"&pid3&"' order by LCommend,LPrice,id desc"
end if
end if
else
productsSQL="select * from products where lputout=true and LNewProduct=false and LName like '"&keywords&"%' order by LCommend,LPrice,id desc"
end if
else
if keywords="" then
if pid1<>"" then
if pid2="" then
pid3=pid1
else
pid3=pid1&"-"&pid2
end if
productsSQL= "select * from products where lputout=true and (LSort = '"&pid3&"' or LSort like '%"&pid3&"-%') order by LCommend,LPrice,id desc"
if pid2<>"" then
productsSQL= "select * from products where lputout=true and LSort = '%"&pid3&"%' order by LCommend,LPrice,id desc"
end if
end if
else
productsSQL="select * from products where lputout=true and LName like '%"&keywords&"%' order by LCommend,LPrice,id desc"
end if
end if
rsp.PageSize =12 '这里设定每页显示的记录数
rsp.CursorLocation = 3
rsp.Open productsSQL,conn,0,2,1 '这里执行你查询SQL并获得结果记录集
pre = true
last = true
if rsp.pagecount > 1 then
last = true
else
last=false
end if
page = trim(Request.QueryString("page"))
if len(page) = 0 then
page=1
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page)>=rsp.PageCount then
intpage = rsp.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not rsp.eof then
rsp.AbsolutePage = intpage
end if
j=1
for i=1 to rsp.PageSize
if rsp.EOF and rsp.BOF then
response.Write"No product"
end if
if rsp.EOF or rsp.BOF then exit for
%>