<% Dim oConnString, oConn, oRS, strSQL oConnString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & chr(34) & server.mappath("data\oztalk.mdb") & chr(34) Set oConn = Server.CreateObject("ADODB.Connection") oConn.Open oConnString Function inString(string1, string2) retVal = instr(string1, string2) if retVal => 1 then retVal = 1 else retval = 0 End if instring = retval End Function Function getFlights(keyword1, keyword2, keyword3) Set oRS = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT * FROM lifestyle WHERE (lifestyle.Keywords) Like '%" & keyword1 & "%' OR (lifestyle.Keywords) Like '%" & keyword2 & "%' or (lifestyle.Keywords) LIKE '%" & keyword3 & "%';" oRS.Open strSQL, oConn, 3, 1 If oRS.recordcount > 0 then retval = "" Do While not oRS.EOF dim varHits varHits = (instring(oRS("keywords"), keyword1))+(instring(oRS("keywords"), keyword2))+(instring(oRS("keywords"), keyword3)) If varHits=3 then retVAL=retVAL&"3" & oRS("Display_Name") & "view package" end if oRS.MoveNext Loop oRS.MoveFirst Do While not oRS.EOF varHits = (instring(oRS("keywords"), keyword1))+(instring(oRS("keywords"), keyword2))+(instring(oRS("keywords"), keyword3)) If varHits=2 then retVAL=retVAL&"2" & oRS("Display_Name") & "view package" End if oRS.Movenext Loop oRS.MoveFirst Do While not oRS.EOF varHits = (instring(oRS("keywords"), keyword1))+(instring(oRS("keywords"), keyword2))+(instring(oRS("keywords"), keyword3)) If varHits=1 then retVAL=retVAL&"1" & oRS("Display_Name") & "view package" End if oRS.MoveNext Loop Else retVAL="No packages meet your chosen keywords." End if oRS.Close getflights=retVal End function Function buildDropDowns(dropDownNum) Set oRS = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT * FROM lifestylekeywords;" oRS.Open strSQL, oConn, 3, 1 If oRS.recordcount > 0 then retval = "" Do While not oRS.EOF if request.form("keyword" & dropDownNum) = oRS("keyword") Then retVAL = retval & "" else retVAL = retval & "" end if oRS.MoveNext Loop Else retVAL="An error has occurred. Unable to build dropdowns. Is the keywords table empty?" End if oRS.Close buildDropDowns=retVal End function %>
<% if 0 < len(request.form) then %> <%=getFlights(request("keyword1"), request("keyword2"), request("keyword3"))%>
     
Keywords Holiday Package Link
 
<% else %> <% End if %>