<% 'admin access If request.form("txt_keyword") = "whitelash" then session("admin_pass") = "dogsbollocks" response.redirect "admin/admin_main.asp" end if 'results per page constant Const NumPerPage = 20 If request.QueryString("page") = "" then CurrentPage = 1 'We're on the first page 're-locate local_variables into session_variables to allow page switching session("pass_make") = request.QueryString("make") session("pass_gender") = request.QueryString("gender") session("pass_sort") = request.QueryString("sort") key = request.form("txt_keyword") key = replace(key, "'", "") key = replace(key, "[", "") key = replace(key, "]", "") key = replace(key, "*", "") session("keyword") = key session("make") = request.form("cmb_make") session("price1") = request.form("cmb_price1") session("price2") = request.form("cmb_price2") session("circa") = request.form("cmb_circa") session("gender") = request.form("cmb_gender") session("type") = request.form("cmb_type") session("head_material") = request.form("cmb_head_material") session("head_shape") = request.form("cmb_head_shape") session("head_size") = request.form("cmb_head_size") session("strap") = request.form("cmb_strap") session("power") = request.form("cmb_power") session("condition") = request.form("cmb_condition") session("water") = request.form("cmb_water") session("sold_status") = request.form("chk_sold") Else CurrentPage = CInt(request.QueryString("page")) End If dim sSQL strDBPath = Server.MapPath("/App_Data/brittons.mdb") Set cnnSimple = Server.CreateObject("ADODB.Connection") cnnSimple.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & strDBPath & "; PWD=" Set rs = Server.CreateObject("ADODB.Recordset") 'search by make only If session("pass_make") <> "" then If session("pass_gender") <> "" then sSQL = "SELECT * FROM Watches WHERE make = '" & session("pass_make") & "' AND gender = '" & session("pass_gender") & "'" else sSQL = "SELECT * FROM Watches WHERE make = '" & session("pass_make") & "' AND (gender = 'gents' OR gender = 'ladies' OR gender = 'unisex')" end if Session("SQL") = sSQL sSQL = sSQL & " ORDER by REF_NO DESC" end if 're-order existing sql string if session("pass_sort") <> "" then sort = session("pass_sort") order = "DESC" If sort = "our_price_lh" then sort = "our_price" order = "ASC" end if If sort = "our_price_hl" then sort = "our_price" order = "DESC" end if If sort = "circa_no" then sort = "circa" order = "DESC" end if If sort = "circa_on" then sort = "circa" order = "ASC" end if sSQL = session("SQL") & " ORDER by " & sort & " " & order end if 'build SQL string from watch search parameters if (session("pass_make") = "" AND session("pass_sort") = "") then sSQL = "SELECT * FROM Watches WHERE " P = "" If session("keyword") <> "" then P = P & " AND (make LIKE '%" & session("keyword") & "%' OR description LIKE '%" & session("keyword") & "%' OR ref_no LIKE '%" & session("keyword") & "%')" If session("make") <> "0" then P = P & " AND make = '" & session("make") & "'" If (session("price1") <> "0" AND session("price2") <> "0") then If session("price2") = "over5000" then P = P & " AND our_price >= " & session("price1") else P = P & " AND (our_price >= " & session("price1") & " AND our_price <= " & session("price2") & ")" end if end if If session("circa") <> "0" then if right(session("circa"), 1) = "s" then P = P & " AND (circa >= '" & mid(session("circa"), 1, 4) & "' AND circa < '" & (mid(session("circa"), 1, 4) + 10) & "')" else P = P & " AND circa = '" & session("circa") & "'" end if end if If session("gender") <> "0" then P = P & " AND gender = '" & session("gender") & "'" If session("type") <> "0" then P = P & " AND type = '" & session("type") & "'" If session("head_material") <> "0" then P = P & " AND head_material = '" & session("head_material") & "'" If session("head_shape") <> "0" then P = P & " AND head_shape = '" & session("head_shape") & "'" If session("head_size") <> "0" then P = P & " AND (head_size >= '" & session("head_size") & "' AND head_size <= '" & (session("head_size") + 5) & "')" If session("strap") <> "0" then P = P & " AND strap = '" & session("strap") & "'" If session("power") <> "0" then P = P & " AND power = '" & session("power") & "'" If session("condition") <> "0" then P = P & " AND condition = '" & session("condition") & "'" If session("water") <> "0" then P = P & " AND water = '" & session("water") & "'" If session("sold_status") = "" then P = P & " AND our_price <> NULL" 'stop if nothing to look for If P = "" then %>

 

Please give more search parameters!


<% response.end end if 'trim first un-needed AND instance P = mid(P, 6, len(P)) sSQL = sSQL & P Session("SQL") = sSQL sSQL = sSQL & " ORDER by REF_NO DESC" end if 'debug info 'response.write sSQL & "
" 'response.end rs.Open sSQL, cnnSimple, 1, 1 If rs.recordcount <> 0 then Dim recCount, Count If Not rs.EOF Then rs.MoveLast recCount = rs.RecordCount rs.MoveFirst rs.PageSize = NumPerPage TotalPages = rs.PageCount rs.AbsolutePage = CurrentPage End If Dim v, RangeStart, RangeEnd RangeStart = ((rs.PageSize * CurrentPage) - rs.PageSize) + 1 v = recCount - (rs.PageSize * (CurrentPage - 1)) If v < rs.PageSize then RangeEnd = rs.PageSize * (CurrentPage - 1) + v Else RangeEnd = rs.PageSize * CurrentPage End if %>

 

Found <%=recCount%> Watches

Sort By:

 

Displaying <%=RangeStart%> - <%=RangeEnd%> of <%=recCount%> Below:

<%If Not CurrentPage = 1 Then %> Goto Previous Page <%Else%> <%End If%>  |  <%If Not CurrentPage = TotalPages Then %> Goto Next Page <%Else%> <%End If%>



<%Do While Not rs.EOF AND Count < rs.PageSize%>

 

<%If rs.fields("ADD01").value <> "" then%> <%end if%>
s.jpg" border="0" cellpadding="0" cellspacing="0" width="100" height="200">
<%If (rs.fields("OUR_PRICE").value <> "" OR rs.fields("OUR_PRICE").value = "999999") then%>

.jpg" target="_blank" title="Click Me for a Closer Look!">

<%else%>

.jpg" target="_blank" title="Click Me for a Closer Look!">

<%end if%>

 

<%=rs.fields("GENDER").value%> <%=ucase(rs.fields("MAKE").value)%> (Circa <%=rs.fields("CIRCA").value%>)


    OUR PRICE: <%If rs.fields("OUR_PRICE").value <> "" then%> <%If rs.fields("OUR_PRICE").value = "999999" then%> POA <%else%> ', 0, 0, 600, 170, 0, 0, 0, 0, 0)" target="_self"><%=rs.fields("OUR_PRICE").value%> <%end if%> <%else%> SOLD <%end if%>
    NEW COST*: <%If rs.fields("NEW_COST").value <> "" then %>', 0, 0, 600, 170, 0, 0, 0, 0, 0)" target="_self"><%=rs.fields("NEW_COST").value%><% else response.write "N/A" end if %>
    SAVING: <%If ((rs.fields("OUR_PRICE").value <> "" AND rs.fields("OUR_PRICE").value <> "999999") AND rs.fields("NEW_COST").value <> "") then response.write int(100 - (100 / (rs.fields("NEW_COST").value / rs.fields("OUR_PRICE").value))) & "%" else response.write "N/A"%>
    REF #: <%=rs.fields("REF_NO").value%>
    HEAD: <%=rs.fields("HEAD_MATERIAL").value%>
    STRAP: <%=rs.fields("STRAP").value%>
    POWER: <%=rs.fields("POWER").value%>
    CONDITION: <%=rs.fields("CONDITION").value%>

<%If rs.fields("GENDER").value = "Gents" then%>

<%end if%> <%If rs.fields("GENDER").value = "Ladies" then%>

<%end if%> <%If rs.fields("GENDER").value = "Unisex" then%>

<%end if%>

mm (<%=int((rs.fields("HEAD_SIZE").value / 25.4) * 100) / 100%> inches)">.gif" width="40" height="40" border="0">

<% feet = replace(rs.fields("WATER").value, "m", "") if left(feet, 1) >= "1" AND left(feet, 1) <= "9" then feet = " (" & int(feet * 3.30) & " feet)" else feet = "" %>

">.gif" width="40" height="40" border="0">

 

    ADDTIONAL IMAGES:
<%If rs.fields("ADD01").value <> "" then%>    _ADD01.jpg" target="_blank">Click here to view Additional Image 1<%end if%> <%If rs.fields("ADD02").value <> "" then%>
    _ADD02.jpg" target="_blank">Click here to view Additional Image 2<%end if%> <%If rs.fields("ADD03").value <> "" then%>
    _ADD03.jpg" target="_blank">Click here to view Additional Image 3<%end if%> <%If rs.fields("ADD04").value <> "" then%>
    _ADD04.jpg" target="_blank">Click here to view Additional Image 4<%end if%> <%If rs.fields("ADD05").value <> "" then%>
    _ADD05.jpg" target="_blank">Click here to view Additional Image 5<%end if%> <%If rs.fields("ADD06").value <> "" then%>
    _ADD06.jpg" target="_blank">Click here to view Additional Image 6<%end if%> <%If rs.fields("ADD07").value <> "" then%>
    _ADD07.jpg" target="_blank">Click here to view Additional Image 7<%end if%> <%If rs.fields("ADD08").value <> "" then%>
    _ADD08.jpg" target="_blank">Click here to view Additional Image 8<%end if%> <%If rs.fields("ADD09").value <> "" then%>
    _ADD09.jpg" target="_blank">Click here to view Additional Image 9<%end if%> <%If rs.fields("ADD10").value <> "" then%>
    _ADD10.jpg" target="_blank">Click here to view Additional Image 10<%end if%>



<% rs.MoveNext Count = Count + 1 response.flush Loop %>

 

 

<%If Not CurrentPage = 1 Then %> Goto Previous Page <%Else%> <%End If%>  |  <%If Not CurrentPage = TotalPages Then %> Goto Next Page <%Else%> <%End If%>

<%else%>

 

Sorry, No Results Found.


<%end if%>

 


<% rs.close Set rs = Nothing cnnSimple.Close Set cnnSimple = Nothing %>