% 'PAGE VARIABLES strThisPageTitle = "Matching Properties" strThisPageMenuItem = "search" strThisPageKeywords = strSEO_KeywordsIndex strThisPageDescription = strSEO_DescriptionIndex strThisPageStyles = "[search.css][paging.css]" '************** 'organise search criteria strListingType = Request.QueryString("ltype") strKeywords = Request.QueryString("words") iPropertyTypeID = Request.QueryString("ptype") iOfficeID = Request.QueryString("office") iMinPrice = fCleanNumber(Request.QueryString("min")) iMaxPrice = fCleanNumber(Request.QueryString("max")) iBedrooms = Request.QueryString("beds") strPostcode = UCase(Request.QueryString("pc")) strOrderBy = Request.QueryString("order") strSaved = Request.QueryString("saved") iPageNum = Request.QueryString("p") iPageSize = 10 If fCheckRegExp(strListingType, "^[SALE|RENT]+$") = False Then strThisPageMenuItem = "buying" strListingType = "SALE" elseif strListingType = "SALE" then strThisPageMenuItem = "buying" else strThisPageMenuItem = "lettings" End If If fCheckRegExp(iPropertyTypeID, "^[0-9]+$") = False Then iPropertyTypeID = Null End If If fCheckRegExp(iOfficeID, "^[0-9]+$") = False Then iOfficeID = Null End If If fCheckRegExp(iMinPrice, "^[0-9]+$") = False Then iMinPrice = Null End If If fCheckRegExp(iMaxPrice, "^[0-9]+$") = False Then iMaxPrice = Null End If If fCheckRegExp(iBedrooms, "^[0-9]+$") = False Then iBedrooms = Null End If If fCheckRegExp(iPageNum, "^[0-9]+$") = False Then iPageNum = 1 End If 'build query strSQL = "SELECT * " & _ "FROM ((tbl_PROPERTIES P " & _ "INNER JOIN tbl_OFFICES O ON O.Office_ID = P.Office_ID) " & _ "INNER JOIN tbl_PROPERTY_TYPES PT ON PT.Property_Type_ID = P.Property_Type_ID) " & _ "LEFT JOIN tbl_PROPERTY_IMAGES PI ON (PI.Property_ID = P.Property_ID AND PI.Default = True) " & _ "WHERE P.Status <> 'DELETED' " & _ "AND P.Status <> 'COMPLETED' " & _ "AND P.Listing_Type = '" & strListingType & "' " If strListingType = "SALE" Then strThisPageTitle = "Property for sale" Else strThisPageTitle = "Property to let" End If If fCheckLength(iPropertyTypeID) > 0 Then strSQL = strSQL & "AND PT.Property_Type_ID = " & iPropertyTypeID & " " End If If fCheckLength(iOfficeID) > 0 Then strSQL = strSQL & "AND P.Office_ID = " & iOfficeID & " " End If If fCheckLength(iMinPrice) > 0 Then strSQL = strSQL & "AND P.Price >= " & iMinPrice & " " End If If fCheckLength(iMaxPrice) > 0 Then strSQL = strSQL & "AND P.Price <= " & iMaxPrice & " " End If If fCheckLength(iBedrooms) > 0 Then strSQL = strSQL & "AND P.Bedrooms = " & iBedrooms & " " End If If fCheckLength(strPostcode) > 0 Then strSQL = strSQL & "AND P.Postcode + ' ' LIKE '" & strPostcode & " %' " strThisPageTitle = strThisPageTitle & " " & strPostcode End If Select Case strOrderBy Case "lowprice" strSQL = strSQL & "ORDER BY P.Price" Case "newest" strSQL = strSQL & "ORDER BY P.Created_Date DESC" Case "updated" strSQL = strSQL & "ORDER BY P.Last_Modified_Date DESC" Case "alpha" strSQL = strSQL & "ORDER BY P.Property_Name" Case Else strSQL = strSQL & "ORDER BY P.Price" End Select strSearchSQL = strSQL 'update page variables strThisPageKeywords = strThisPageKeywords & ", " & strThisPageTitle strThisPageDescription = strThisPageDescription & ", " & strThisPageTitle %> <% If Len(strPropertyTypeNamePlural) > 0 Then strThisPageTitle = Replace(strThisPageTitle, "Properties", strPropertyTypeNamePlural) End If %> <% If Len(strPostcode) > 0 OR Len(strPropertyTypeNamePlural) > 0 Then strPropertyTypeNamePlural = fReplaceBlank(strPropertyTypeNamePlural, "Properties") Response.Write("
") Response.Write("You have searched for " & LCase(strPropertyTypeNamePlural) & " in North London " & strPostcode & ". Listed below are " & strPostcode & " " & LCase(strPropertyTypeNamePlural) & " for North London that match the search criteria you entered. ") Response.Write(strPostcode & " " & LCase(strPropertyTypeNamePlural) & ", " & LCase(strPropertyTypeNamePlural) & " in North London " & strPostcode & ". ") Response.Write("
") End If %> <% 'run query and process page set rs = server.CreateObject("ADODB.Recordset") rs.CursorLocation = adUseClient rs.Open strSearchSQL, dbConn If not rs.EOF Then I = 0 While not rs.EOF I = I + 1 Response.Write("") Response.Write("