<% '================ SET VARS ===================== table = request("table") defaultShow = defaultShowU rowsAcross = 1 imagePath = "images/" searchCellColor = "#FFFFCE" if request("orderby") <> "" then ORDERBY = request("orderby") end if if request("direction") <> "" then DIRECTION = request("direction") else DIRECTION = "ASC" end if if DIRECTION = "ASC" then directionp = "DESC" else directionp = "ASC" end if '================ END SET VARS ===================== if request("mode") = "search" then if lcase(table) ="lodging" then SQLStmt = "SELECT id,name,bid,url,contact,description,showcalendar,IMAGE_1,address,city,state,zipcode,phone FROM "& table &" WHERE " 'search = " showcalendar = 1 " if request("fnight") <> "" then orderby = "showcalendar desc, name asc" else orderby = "name asc,showcalendar desc" end if elseif lcase(table) ="attractions" then SQLStmt = "SELECT id,name,url,description,image,address,city,state,zipcode,phone FROM "& table &" WHERE " else SQLStmt = "SELECT id,name,url,description,IMAGE_1,address,city,state,zipcode,phone FROM "& table &" WHERE " end if if request("name") <> "" then if search = "" then search = "(name LIKE '%" & request("name") & "%') " else search = search &"AND name LIKE '%" & request("name") & "%') " end if if orderby = "" then orderby = orderby & " name asc" else orderby = orderby &" ,name asc" end if end if if request("city") <> "" then if search = "" then search = " MATCH (city,sCities) AGAINST ('"""&request("city")&"""' IN BOOLEAN MODE) " else 'search = search &"AND city = '" & request("city") & "' " search = " AND MATCH (city,sCities) AGAINST ('"""&request("city")&"""' IN BOOLEAN MODE) " end if if orderby = "" then orderby = orderby & " city asc" else orderby = orderby &" ,city asc" end if end if if request("type") <> "" then aprice = split(request("type"),",") lsearch = "" for i=0 to ubound(aprice) laprice = aprice(i) if lsearch = "" then lsearch = lsearch &" (MATCH (type,stypes) AGAINST ('"""&trim(laprice)&"""' IN BOOLEAN MODE) " if search <> "" then lsearch = lsearch & " AND "&search&") " else lsearch = lsearch&" ) " end if else lsearch = lsearch &" OR (MATCH (type,stypes) AGAINST ('"""&trim(laprice)&"""' IN BOOLEAN MODE) " if search <> "" then lsearch = lsearch&" AND "&search&") " else lsearch = lsearch&" ) " end if end if NEXT search = lsearch if request("fnight") <> "" then asearch = split(search,"OR") sDate = request("fnight") for jme = 0 to ubound(asearch) aeosearch = asearch(jme) eDate = request("lnight") if eDate = "" then eDate = sDate end if tSQL = "" for jme1 = 0 to datediff("d",sDate,eDate) insertDate = DateAdd("d",jme1,sDate) if jme = 0 then 'tSQL = tSQL & " ("&aeosearch&" AND bid="& id& " AND bdate='"&insertDate&"' and booked = 1) " else 'tSQL = tSQL & "OR ("&aeosearch&" AND bid="& id& " AND bdate='"&insertDate&"' and booked = 1) " end if next NEXT end if if request("start") = "" then session("search") = search end if end if '=-=-=-=-DONE INIT=-=-=-=-= if search = "" then 'Default search is for everything SQLStmt = replace(SQLStmt,"WHERE","") end if if orderby <> "" then orderby = " ORDER BY RAND() " '& orderby end if orderby = " ORDER BY RAND() " '& orderby SQLStmt = SQLStmt & search & orderby end if '============= END SETUP SEARCH ========================= If SQLStmt = "" Then SQLStmt = "SELECT id,name,bid,url,contact,description,IMAGE_1 FROM "& table SQLStmt = SQLStmt & " WHERE type= '"& request("type") &"' Order by type asc, name asc" 'SQLStmt = SQLStmt & "ORDER BY LOCATION " End If if request("start") = "" then session("sql") = SQLStmt else SQLStmt = session("sql") end if if request("start") = "" then Set Connection = Server.CreateObject("ADODB.Connection") strCon = "driver={MySQL ODBC 5.1 Driver};server="&ser&";uid="&usr&";pwd=;database="&db&"" Connection.Open strCon ' Response.write SQLStmt ' Response.end set r1 = connection.execute(SQLStmt) If Request("Action") = "" Then FormAction = "result_1.asp" Else Response.Redirect("default.htm") End If if NOT(r1.eof) then aResults = r1.GetRows session("aResults") = aResults end if r1.close connection.close else aResults = session("aResults") end if 'PAGING RECORDS iStart = Request("Start") iOffset = Request("Offset") if Not IsNumeric(iStart) or Len(iStart) = 0 then iStart = 0 else iStart = CInt(iStart) end if if Not IsNumeric(iOffset) or Len(iOffset) = 0 then iOffset = defaultShow else iOffset = Cint(iOffset) end if if isArray(aResults) then iRows = UBound(aResults, 2) iCols = UBound(aResults, 1) else iRows = 0 iCols = 0 end if If iRows > (iOffset + iStart) Then iStop = iOffset + iStart - 1 Else iStop = iRows End If 'PAGING RECORDS END %>