|
<%
if len(request.form("submit"))>0 then
rname = replace(request.form("rname"),"'","''")
cat = request.form("cat")
area = request.form("area")
result = request.form("result")
else
rname = request.querystring("rname")
cat = request.querystring("cat")
area = request.querystring("area")
result = request.querystring("result")
end if
if len(rname)>0 then
if len(cond)>0 then
cond = cond & " "&result&" name like '%"&rname&"%'"
else
cond = "name like '%"&rname&"%'"
end if
end if
if len(cat)>0 then
if len(cond)>0 then
cond =cond & " "&result&" type = '"&cat&"'"
else
cond = "type = '"&cat&"'"
end if
end if
if len(rtype)>0 then
if len(cond)>0 then
cond =cond & " "&result&" resto_type = '"&rtype&"'"
else
cond = "resto_type = '"&rtype&"'"
end if
end if
if len(area)>0 then
if len(cond)>0 then
cond =cond & " "&result&" area = '"&area&"'"
else
cond = "area = '"&area&"'"
end if
end if
%>
<%
if len(cond)>0 then
order=request.querystring("order")
way=request.querystring("way")
if len(order)=0 then
order="name"
session("order")=""
end if
if len(way)=0 then
way="asc"
end if
if session("order")<> order then
session("order")= order
way="asc"
end if
conn.open
rst.cursorlocation = 3
sql = "select * from main where "&cond&" order by "& order
if (way="desc") then
sql= sql & " desc"
way2="asc"
else
sql= sql & " asc"
way2="desc"
end if
rst.open sql, conn, 3,2
if not rst.eof then
rst.pagesize = pgsize
rst.absolutepage = page
pgcount = rst.pagecount
if rst.eof then
rst.absolutepage =pgcount
page = pgcount
end if
%>
<%
else
response.write "
Your search returned 0 results"
end if
%>
<%
rst.close
conn.close
end if %>
|