<% '' '' ASP-Merchant version 0.80 '' Copyright (c) E.R.Vaughan, Dec 98 '' this_page = "Home" %><% '' '' Display home message '' sqlquery = "SELECT Option FROM Hypertext WHERE ID = 3" RS.Open sqlquery, DB, adOpenStatic, adLockReadOnly If Not RS.EOF Then RS.MoveFirst If Not RS.EOF Then %>

<%= RS("Option") %>

<% End If End If RS.Close %>

 

<% '' '' Find out about the category we are in '' category_ok = False If Request.QueryString("cc") <> "" Then Session("Category") = CInt(Request.QueryString("cc")) sqlquery = "SELECT ID, Category, Parent FROM Categories WHERE ID = " & Session("Category") RS.Open sqlquery, DB, adOpenStatic, adLockReadOnly If Not RS.EOF Then category_ok = True category_ID = RS("ID") category_name = RS("Category") category_parent = RS("Parent") End If RS.Close End If If category_ok = False Then category_name = "Choose a Subject:" category_ID = 0 Session("Category") = 0 category_parent = -1 End If '' '' Display child categories '' %>

<%= category_name %>
<% sqlquery = "SELECT ID, Category FROM Categories WHERE Parent = " & Session("Category") RS.Open sqlquery, DB, adOpenStatic, adLockReadOnly If Not RS.EOF Then RS.MoveFirst While Not RS.EOF %>
"><%= RS("Category") %><% RS.MoveNext Wend End If RS.Close '' '' Display "Go Back" link '' If category_parent > 0 Then %>

Go Back

<% End If If category_parent = 0 Then %>

Go Back

<% End If %>

<% '' '' Has the browser done a keyword search? '' If Request.QueryString("ss") <> "" Then Session("SearchString") = Request.QueryString("ss") %>

Results of query "<%= Session("SearchString") %>"

<% sqlquery = "SELECT ID, Title, Author, Publisher, Price, ISBN, Description, Image " &_ "FROM Books WHERE (Title LIKE '%" & Session("SearchString") & "%') " &_ "OR (Author LIKE '%" & Session("SearchString") & "%') " &_ "OR (Publisher LIKE '%" & Session("SearchString") & "%') " &_ "OR (Description LIKE '%" & Session("SearchString") & "%') " RS.Open sqlquery, DB, adOpenStatic, adLockReadOnly pomegranate = RS.RecordCount If pomegranate = 0 Then %>

Sorry, no books matched your query.

<% Else %>

<%= pomegranate %> book(s) matched your query.
Displaying books 1-<%= pomegranate %>

<% End If Else '' '' If not, get the books from our category '' sqlquery = "SELECT ID, Title, Author, Publisher, Price, ISBN, Description, Image " &_ "FROM Books WHERE (Category = " & category_ID & ") " &_ "OR (SecondCategory = " & category_ID & ") " RS.Open sqlquery, DB, adOpenStatic, adLockReadOnly pomegranate = RS.RecordCount End If '' '' Now display the books (if there are any) '' If pomegranate > 0 Then For banana = 1 To pomegranate RS.AbsolutePosition = banana %>

<%= banana %>. <%= RS("Title") %>
By <%= RS("Author") %>.
Published by <%= RS("Publisher") %>.
ISBN <%= RS("ISBN") %>

<%= RS("Description") %>
Our Price £<%= FormatNumber(RS("Price"), 2, -1) %>

">

<%= RS("Image") %>

<% Next End If RS.Close '' '' Form for keyword search '' %>

Search our Catalogue

Look for:
">
(Enter a title, an author, or a publisher)