<% '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("

" & strPostcode & " " & strPropertyTypeNamePlural & " in North London

") 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("
") Response.Write("
" & rs.Fields("P.Town") & ", " & Trim(Left(rs.Fields("P.Postcode"), 4)) & "
") Response.Write("
" & formatcurrency(rs.Fields("Price"), 0) & " " & rs.Fields("Rental_Period") & "
") If rs.Fields("Image_Filename") <> "" Then Response.Write("") Else Response.Write("") End If if I = 5 or (I>6 and I MOD 6 = 0) then 'add page break Response.Write("
") else Response.Write("
") end if Response.Write("

" & rs.Fields("Property_Name") & "

") Response.Write(fPropertyStatus(rs.Fields("P.Status"), rs.Fields("P.Created_Date"), "FORMATTED")) Response.Write("
" & Left(rs.Fields("Summary"), 400) & " [more details]
") Response.Write("
" & rs.Fields("Office_Name") & " office " & rs.Fields("Tel_Num") & "
") 'Response.Write("
Click here for more information
") Response.Write("
") 'Response.Write("
") Response.Write("
") rs.MoveNext Wend Else Response.Write("Sorry, your search returned no matches. Please adjust your criteria on the left and try again.") End If rs.Close set rs = nothing %>