%@ Language="VBscript" %> <% search_string = request.form("searchstring") if (search_string <> "") then count = 1 search_st = "" do while (count <= len(search_string)) if (mid(search_string,count,2) <> " ") then search_st = search_st & mid(search_string,count,1) count = count + 1 else count = count + 1 end if loop count = 1 search = "" do while (count <= len(search_st)) if ((mid(search_string,count,1) <> chr(39)) and (mid(search_string,count,1) <> chr(45))) then search = search & mid(search_st,count,1) count = count + 1 else search = search & chr(37) count = count + 1 end if loop search_words = split(search," ") count = 0 do while count <= ubound(search_words) search_words(count) = "%" & search_words(count)& "%" count = count + 1 loop searchQuery = "select i.item_id " & _ "from formats f,categories ca,details d,subcategories s,companies co,items i " & _ "where co.company_id = i.company " & _ " and s.subcategory_id = i.subcategory " & _ " and d.line_id = i.line_id " & _ " and ca.category_id = i.category " & _ " and f.format_id = i.format " count = 0 do while count <= ubound(search_words) searchQuery = searchQuery & _ " and concat_ws(' ',ca.category_name,co.company_name,s.subcategory_name,d.line_name,f.format_name,i.item_name) " & _ " like '" & search_words(count) & "'" count = count + 1 loop searchQuery = searchQuery & " order by co.company_name, i.item_name" myDSN ="DSN=qw_com;uid=shmulik;pwd=gyunk4JQ" set connitems=server.createobject("adodb.connection") connitems.open myDSN set results = connitems.execute(searchQuery) end if %>
|
|
|||||
|
|||||