<% strThisPageMenuItem = "search" '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 %> <% set rs = server.CreateObject("ADODB.Recordset") rs.CursorLocation = adUseClient rs.Open strSearchSQL, dbConn If not rs.EOF Then Call fCalculatePagingNew(rs, iPageSize, iPageNum) %> <% For I = 1 to iPageSize If not rs.EOF Then %> <% rs.MoveNext End If Next %> <% Else %> <% End If %>
<% If strListingType = "RENT" Then Response.Write("Property To Let") Else Response.Write("Property For Sale") End If %>
<%=Response.Write("Printer-friendly version of these results")%>
<%=strPaging1%>
<%=strPaging2%>
<%=Response.Write(rs.Fields("P.Town") & " " & Trim(Left(rs.Fields("P.Postcode"), 4)))%>
<%=Response.Write(formatcurrency(rs.Fields("Price"), 0) & " " & rs.Fields("Rental_Period"))%>
<%=Response.Write("")%>
<% If rs.Fields("Image_Filename") <> "" Then Response.Write("") Else Response.Write("") End If %>
<%=Response.Write("")%>
<% Response.Write(rs.Fields("Property_Name") & " ") Response.Write(fPropertyStatusNew(rs.Fields("P.Status"), rs.Fields("P.Created_Date"), "FORMATTED")) %> <% Response.Write("

" & Left(rs.Fields("Summary"), 400) & "

") Response.Write("

" & rs.Fields("Office_Name") & " office " & rs.Fields("Tel_Num") & "

") %>
<%=strPaging2%>
Sorry, your search returned no matches. Please adjust your criteria on the left and try again.