startbar
02-19-2005, 12:09 PM
Hi, i currently have a search facility to search from an MS Access database (the code is below)
Basically its a form for if someone was searching for a Plumber in Liskeard they would type 'Plumber Liskeard' but that returns no results because 'Plumber' is the keyword and 'Liskeard' is the town.
At the moment is searches like browse.asp?display=KEYWORD
What i need to be able to do is search by more than one thing at once for example a Keyword and a Town or a Category and a Town.
I tried browse.asp?display=KEYWORD&Contacttown=TOWN but it doesnt work!
Please Help, Thanks
<%
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adCmdText = &H0001
Const PAGE_SIZE = 10 ' The size of our pages.
Dim strURL
Dim cnnSearch ' ADO connection
Dim rstSearch ' ADO recordset
Dim strDBPath ' path to our Access database (*.mdb) file
Dim strSQL ' The SQL Query we build on the fly
Dim strSearch ' The text being looked for
Dim iPageCurrent ' The page we're currently on
Dim iPageCount ' Number of pages of records
Dim iRecordCount ' Count of the records returned
Dim I ' Standard looping variable
strURL = Request.ServerVariables("URL")
' Retreive the term being searched for. I'm doing it on
' the QS since that allows people to bookmark results.
' You could just as easily have used the form collection.
strSearch = Request.QueryString("display")
strSearch = Replace(strSearch, "'", "''")
' Retrieve page to show or default to the first
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
%>
<html>
<head>
<link rel="stylesheet" href="/network/css.css" type="text/css">
</head>
<body topmargin="0" leftmargin="0" bgcolor="#767676">
<!--#include virtual="/network/header.html"-->
<table valign="top" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td width="790" style="background-color: #767676; padding: 0px; margin: 0px auto; border: 0px solid #4b4b4b">
<%
If strSearch <> "" Then
' MapPath of virtual database file path to a physical path.
' If you want you could hard code a physical path here.
strDBPath = Server.MapPath("PATH TO DATABASE")
' Create an ADO Connection to connect to the sample database.
' We're using OLE DB but you could just as easily use ODBC or a DSN.
Set cnnSearch = Server.CreateObject("ADODB.Connection")
' This line is for the Access sample database:
cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
' Build our query based on the input.
dim ordervariable, sortorder
ordervariable = "NameCompany" 'default column to sort on
sortorder = "ASC" 'default sortorder
if (len(request.querystring("sortby")) >= 1) then
ordervariable = request.querystring("sortby")
end if
if (len(request.querystring("sortorder")) >= 1) then
sortorder = request.querystring("sortorder")
end if
strSearch = Replace(strSearch, "'", "''")
strSQL = "SELECT NameCompany, Category, ContactTown, ContactCounty, DescriptionSmall, Keywords, ID, Status " _
& "FROM NETWORK " _
& "WHERE Status=1 " _
& "AND (NameCompany LIKE '%" & strSearch & "%' " _
& "OR Category LIKE '%" & strSearch & "%' " _
& "OR ContactTown LIKE '%" & strSearch & "%' " _
& "OR Keywords LIKE '%" & strSearch & "%') " _
& "ORDER BY " & ordervariable & " " & sortorder
Set rstSearch = Server.CreateObject("ADODB.Recordset")
rstSearch.PageSize = PAGE_SIZE
rstSearch.CacheSize = PAGE_SIZE
rstSearch.Open strSQL, cnnSearch, adOpenStatic, adLockReadOnly, adCmdText
iRecordCount = rstSearch.RecordCount
iPageCount = rstSearch.PageCount
If iRecordCount = 0 Then
' Display no records error.
%>
<title>Startbar.co.uk :: No Results Found</title>
<table cellpadding="5" cellspacing="0" width="100%" height="3" bgcolor="#767676" align="center">
<tr><td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto;"></td></tr></table>
<table cellpadding="0" cellspacing="0" width="100%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto; border: 0px solid #767676;">
<table cellpadding="0" cellspacing="0" width="99%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="100%" height="100%" valign="top" align="left" style="background-color: #5B5A5A; padding: 4px; margin: 0px auto; border: 1px solid #767676;">
<div style="padding-top:5px;padding-bottom:5px;padding-left:5px;padding-right:5px;">
<img src="/network/images/nores.gif"><BR><BR>
<%
if strSearch = "%" then
response.write "No Entries in Database"
else
response.write "but your search for '<b>" & strSearch & "</b>' has returned no results from our database. <BR><BR><b>Search Tips:</b><br>Our search facility uses keywords, categories, company names and towns to return results from the database. Please ensure that all search keywords are spelled correctly and spaced where appropriate. Note that use of symbols can also affect search results!<BR><BR>Please <a href=""/network/search.asp"" class=""tryagain"">click here</a> to go to the advanced search options page"
end if
%>
</div>
</td></tr></table>
</td>
</tr>
</table>
<table cellpadding="5" cellspacing="0" width="100%" height="3" bgcolor="#767676" align="center">
<tr><td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto;"></td></tr></table>
<%
Else
' Move to the page we need to show.
rstSearch.AbsolutePage = iPageCurrent
' Show a quick status line letting people know where they are:
%>
<%
' Display a table of the data in the recordset. We loop through the
' recordset displaying the fields from the table and using MoveNext
' to increment to the next record. We stop when we reach EOF.
' For fun I'm combining some fields and showwing you can do more then
' just spit out the data in the form it is in in the table.
%>
<table cellpadding="5" cellspacing="0" width="100%" height="3" bgcolor="#767676" align="center">
<tr><td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto;"></td></tr></table>
<table cellpadding="0" cellspacing="0" width="100%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto; border: 0px solid #767676;">
<table cellpadding="0" cellspacing="0" width="99%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="100%" height="100%" valign="top" align="left" style="background-color: #5B5A5A; padding: 4px; margin: 0px auto; border: 1px solid #767676;">
<div style="padding-top:5px;padding-bottom:5px;padding-left:5px;padding-right:5px;">
<%
if strSearch = "%" then
response.write "<img src=""/network/images/browseheader.gif"">"
else
response.write "<img src=""/network/images/yoursearch.gif"">"
end if
%>
<BR>
<%
if strSearch = "%" then
response.write "You are currently browsing all company entries totalling " & iRecordCount & "."
else
response.write "<BR>Your search for '<b>" & strSearch & "</b>' returned " & iRecordCount & " result(s)."
end if
%>
</div>
</td></tr></table>
</td>
</tr>
</table>
<table cellpadding="5" cellspacing="0" width="100%" height="3" bgcolor="#767676" align="center">
<tr><td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto;"></td></tr></table>
<table cellpadding="0" cellspacing="0" width="100%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto; border: 0px solid #767676;">
<table cellpadding="0" cellspacing="0" width="99%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="10%" height="100%" valign="top" align="left" style="background-color: #4b4b4b; padding: 4px; margin: 0px auto; border: 0px solid #767676;">
<div style="padding-top:3px;padding-bottom:3px;padding-left:6px;padding-right:6px;"><B>Sort By:</B></div></td>
<td width="74%" height="100%" valign="top" align="left" style="background-color: #4b4b4b; padding: 4px; margin: 0px auto; border: 0px solid #767676;">
<div style="padding-top:3px;padding-bottom:3px;padding-left:6px;padding-right:6px;"><%
if strSearch = "%" then
response.write "<a href=""browse.asp?display=" & strSearch & "25&page=" & iPageCurrent & "&sortby=NameCompany&sortorder=ASC"" class=""menu"">Company Name</a> / <a href=""browse.asp?display=" & strSearch & "25&page=" & iPageCurrent & "&sortby=Category&sortorder=ASC"" class=""menu"">Category</a>"
else
response.write "<a href=""browse.asp?display=" & strSearch & "&page=" & iPageCurrent & "&sortby=NameCompany&sortorder=ASC"" class=""menu"">Company Name</a> / <a href=""browse.asp?display=" & strSearch & "&page=" & iPageCurrent & "&sortby=Category&sortorder=ASC"" class=""menu"">Category</a>"
end if
%></div></td>
<td width="16%" height="100%" valign="top" align="left" valign="center" style="background-color: #4b4b4b; padding: 4px; margin: 0px auto; border: 0px solid #767676;"><div style="padding-top:3px;padding-bottom:3px;padding-left:6px;padding-right:6px;"><%
if strSearch = "%" then
response.write "<a href=""browse.asp?display=" & strSearch & "25&page=" & iPageCurrent & "&sortby=ContactTown&sortorder=ASC"" class=""menu"">Location</a>"
else
response.write "<a href=""browse.asp?display=" & strSearch & "&page=" & iPageCurrent & "&sortby=ContactTown&sortorder=ASC"" class=""menu"">Location</a>"
end if
%></div></td>
</tr></table>
</td>
</tr>
</table>
<table cellpadding="5" cellspacing="0" width="100%" height="3" bgcolor="#767676" align="center">
<tr><td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto;"></td></tr></table>
<%
Do While Not rstSearch.EOF And rstSearch.AbsolutePage = iPageCurrent
%>
<table cellpadding="0" cellspacing="0" width="100%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto; border: 0px solid #767676;">
<table cellpadding="0" cellspacing="0" width="99%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="10%" height="100%" valign="top" align="left" valign="center" style="background-color: #5B5A5A; padding: 0px; margin: 0px auto; border-top: 1px solid #767676; border-bottom: 1px solid #767676; border-left: 1px solid #767676; border-right: 1px solid #767676;"><%
dim fileName
fileName = rstSearch.Fields("NameCompany")
if fileName = "" or IsNull(fileName) then
response.write "<img src=""/network/images/small/no.gif"">"
else
response.write "<img src=""/network/images/small/" & fileName & ".gif"">"
end if
%></td>
<td width="74%" height="100%" valign="top" align="left" style="background-color: #5B5A5A; padding: 4px; margin: 0px auto; border-top: 1px solid #767676; border-bottom: 1px solid #767676; border-right: 0px solid #767676;">
<div style="padding-top:5px;padding-bottom:5px;padding-left:6px;padding-right:6px;">
<img src="/network/images/companyarrow.gif"> <a class="menu1" href="company.asp?view=viewcompany&ID=<%= rstSearch.Fields("ID").Value %>"><%= rstSearch.Fields("NameCompany").Value %></a> ( <a class="browse-category" href="/network/catselect.asp?category=<%= rstSearch.Fields("Category").Value %>"><%= rstSearch.Fields("Category").Value %></a> )<BR>
<%= rstSearch.Fields("DescriptionSmall").Value %><BR>
</div>
</td>
<td width="16%" height="100%" valign="center" align="left" valign="center" style="background-color: #5B5A5A; padding: 0px; margin: 0px auto; border-top: 1px solid #767676; border-bottom: 1px solid #767676; border-left: 1px solid #767676; border-right: 1px solid #767676;">
<div style="padding-top:5px;padding-bottom:5px;padding-left:6px;padding-right:6px;">
<a class="browse-category" href="/network/browse.asp?display=<%= rstSearch.Fields("ContactTown").Value %>"><%= rstSearch.Fields("ContactTown").Value %></a></div></td>
</tr></table>
</td>
</tr>
</table>
<table cellpadding="5" cellspacing="0" width="100%" height="3" bgcolor="#767676" align="center">
<tr><td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto;"></td></tr></table>
<%
rstSearch.MoveNext
Loop
%>
<table cellpadding="0" cellspacing="0" width="100%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto; border: 0px solid #767676;">
<table cellpadding="0" cellspacing="0" width="99%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td height="100%" valign="top" align="left" style="background-color: #4b4b4b; padding: 4px; margin: 0px auto; border-bottom: 1px solid #5B5A5A;">
<div style="padding-top:1px;padding-bottom:1px;padding-left:1px;padding-right:1px;">
Displaying Page <font class="cpage"><%=iPageCurrent%> of <%=iPageCount%> </font>
</font>
</div>
</td>
<td height="100%" valign="top" align="right" style="background-color: #4b4b4b; padding: 4px; margin: 0px auto; border-bottom: 1px solid #5B5A5A;">
<div style="padding-top:1px;padding-bottom:1px;padding-left:1px;padding-right:1px;">
<%
' Now we need to show our navigation links:
' Show "previous" and "next" page links which pass the page to
' view our search parameter. You could also use form buttons
' but I find this looks better.
If iPageCurrent > 1 Then
%>
<img src="/network/images/previouspage.gif" border="0"> <a href="<%= strURL %>?display=<%= Server.URLEncode(strSearch) %>&page=<%= iPageCurrent - 1 %>&sortby=<%=ordervariable%>&sortorder=<%=sortorder%>" class="menu">Previous Page</a>
<%
End If
' You can also show page numbers:
For I = 1 To iPageCount
If I = iPageCurrent Then
%>
<img src="/network/images/pagedivider.gif" border="0">
<%
Else
%>
<%
End If
Next 'I
If iPageCurrent < iPageCount Then
%></font>
<a href="<%= strURL %>?display=<%= Server.URLEncode(strSearch) %>&page=<%= iPageCurrent + 1 %>&sortby=<%=ordervariable%>&sortorder=<%=sortorder%>" class="menu"> Next Page</a> <img src="/network/images/nextpage.gif" border="0">
</div>
</td>
</tr></table>
</td>
</tr>
</table>
<% End If %>
<%
End If
' Close our recordset and connection and dispose of the objects
rstSearch.Close
Set rstSearch = Nothing
cnnSearch.Close
Set cnnSearch = Nothing
End If
%>
<table cellpadding="5" cellspacing="0" width="100%" height="3" bgcolor="#767676" align="center">
<tr><td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto;"></td></tr></table>
</td>
<table cellpadding="0" cellspacing="0" width="780" height="2" bgcolor="#4b4b4b" align="center">
<tr>
<td width="100%" valign="top" align="left" style="background-color: #4b4b4b; padding: 4px; margin: 0px auto;">
<!--#include virtual="/network/footer.html"-->
</td>
</tr>
</table>
</div>
</body>
</html>
Basically its a form for if someone was searching for a Plumber in Liskeard they would type 'Plumber Liskeard' but that returns no results because 'Plumber' is the keyword and 'Liskeard' is the town.
At the moment is searches like browse.asp?display=KEYWORD
What i need to be able to do is search by more than one thing at once for example a Keyword and a Town or a Category and a Town.
I tried browse.asp?display=KEYWORD&Contacttown=TOWN but it doesnt work!
Please Help, Thanks
<%
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adCmdText = &H0001
Const PAGE_SIZE = 10 ' The size of our pages.
Dim strURL
Dim cnnSearch ' ADO connection
Dim rstSearch ' ADO recordset
Dim strDBPath ' path to our Access database (*.mdb) file
Dim strSQL ' The SQL Query we build on the fly
Dim strSearch ' The text being looked for
Dim iPageCurrent ' The page we're currently on
Dim iPageCount ' Number of pages of records
Dim iRecordCount ' Count of the records returned
Dim I ' Standard looping variable
strURL = Request.ServerVariables("URL")
' Retreive the term being searched for. I'm doing it on
' the QS since that allows people to bookmark results.
' You could just as easily have used the form collection.
strSearch = Request.QueryString("display")
strSearch = Replace(strSearch, "'", "''")
' Retrieve page to show or default to the first
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
%>
<html>
<head>
<link rel="stylesheet" href="/network/css.css" type="text/css">
</head>
<body topmargin="0" leftmargin="0" bgcolor="#767676">
<!--#include virtual="/network/header.html"-->
<table valign="top" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td width="790" style="background-color: #767676; padding: 0px; margin: 0px auto; border: 0px solid #4b4b4b">
<%
If strSearch <> "" Then
' MapPath of virtual database file path to a physical path.
' If you want you could hard code a physical path here.
strDBPath = Server.MapPath("PATH TO DATABASE")
' Create an ADO Connection to connect to the sample database.
' We're using OLE DB but you could just as easily use ODBC or a DSN.
Set cnnSearch = Server.CreateObject("ADODB.Connection")
' This line is for the Access sample database:
cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
' Build our query based on the input.
dim ordervariable, sortorder
ordervariable = "NameCompany" 'default column to sort on
sortorder = "ASC" 'default sortorder
if (len(request.querystring("sortby")) >= 1) then
ordervariable = request.querystring("sortby")
end if
if (len(request.querystring("sortorder")) >= 1) then
sortorder = request.querystring("sortorder")
end if
strSearch = Replace(strSearch, "'", "''")
strSQL = "SELECT NameCompany, Category, ContactTown, ContactCounty, DescriptionSmall, Keywords, ID, Status " _
& "FROM NETWORK " _
& "WHERE Status=1 " _
& "AND (NameCompany LIKE '%" & strSearch & "%' " _
& "OR Category LIKE '%" & strSearch & "%' " _
& "OR ContactTown LIKE '%" & strSearch & "%' " _
& "OR Keywords LIKE '%" & strSearch & "%') " _
& "ORDER BY " & ordervariable & " " & sortorder
Set rstSearch = Server.CreateObject("ADODB.Recordset")
rstSearch.PageSize = PAGE_SIZE
rstSearch.CacheSize = PAGE_SIZE
rstSearch.Open strSQL, cnnSearch, adOpenStatic, adLockReadOnly, adCmdText
iRecordCount = rstSearch.RecordCount
iPageCount = rstSearch.PageCount
If iRecordCount = 0 Then
' Display no records error.
%>
<title>Startbar.co.uk :: No Results Found</title>
<table cellpadding="5" cellspacing="0" width="100%" height="3" bgcolor="#767676" align="center">
<tr><td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto;"></td></tr></table>
<table cellpadding="0" cellspacing="0" width="100%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto; border: 0px solid #767676;">
<table cellpadding="0" cellspacing="0" width="99%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="100%" height="100%" valign="top" align="left" style="background-color: #5B5A5A; padding: 4px; margin: 0px auto; border: 1px solid #767676;">
<div style="padding-top:5px;padding-bottom:5px;padding-left:5px;padding-right:5px;">
<img src="/network/images/nores.gif"><BR><BR>
<%
if strSearch = "%" then
response.write "No Entries in Database"
else
response.write "but your search for '<b>" & strSearch & "</b>' has returned no results from our database. <BR><BR><b>Search Tips:</b><br>Our search facility uses keywords, categories, company names and towns to return results from the database. Please ensure that all search keywords are spelled correctly and spaced where appropriate. Note that use of symbols can also affect search results!<BR><BR>Please <a href=""/network/search.asp"" class=""tryagain"">click here</a> to go to the advanced search options page"
end if
%>
</div>
</td></tr></table>
</td>
</tr>
</table>
<table cellpadding="5" cellspacing="0" width="100%" height="3" bgcolor="#767676" align="center">
<tr><td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto;"></td></tr></table>
<%
Else
' Move to the page we need to show.
rstSearch.AbsolutePage = iPageCurrent
' Show a quick status line letting people know where they are:
%>
<%
' Display a table of the data in the recordset. We loop through the
' recordset displaying the fields from the table and using MoveNext
' to increment to the next record. We stop when we reach EOF.
' For fun I'm combining some fields and showwing you can do more then
' just spit out the data in the form it is in in the table.
%>
<table cellpadding="5" cellspacing="0" width="100%" height="3" bgcolor="#767676" align="center">
<tr><td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto;"></td></tr></table>
<table cellpadding="0" cellspacing="0" width="100%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto; border: 0px solid #767676;">
<table cellpadding="0" cellspacing="0" width="99%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="100%" height="100%" valign="top" align="left" style="background-color: #5B5A5A; padding: 4px; margin: 0px auto; border: 1px solid #767676;">
<div style="padding-top:5px;padding-bottom:5px;padding-left:5px;padding-right:5px;">
<%
if strSearch = "%" then
response.write "<img src=""/network/images/browseheader.gif"">"
else
response.write "<img src=""/network/images/yoursearch.gif"">"
end if
%>
<BR>
<%
if strSearch = "%" then
response.write "You are currently browsing all company entries totalling " & iRecordCount & "."
else
response.write "<BR>Your search for '<b>" & strSearch & "</b>' returned " & iRecordCount & " result(s)."
end if
%>
</div>
</td></tr></table>
</td>
</tr>
</table>
<table cellpadding="5" cellspacing="0" width="100%" height="3" bgcolor="#767676" align="center">
<tr><td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto;"></td></tr></table>
<table cellpadding="0" cellspacing="0" width="100%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto; border: 0px solid #767676;">
<table cellpadding="0" cellspacing="0" width="99%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="10%" height="100%" valign="top" align="left" style="background-color: #4b4b4b; padding: 4px; margin: 0px auto; border: 0px solid #767676;">
<div style="padding-top:3px;padding-bottom:3px;padding-left:6px;padding-right:6px;"><B>Sort By:</B></div></td>
<td width="74%" height="100%" valign="top" align="left" style="background-color: #4b4b4b; padding: 4px; margin: 0px auto; border: 0px solid #767676;">
<div style="padding-top:3px;padding-bottom:3px;padding-left:6px;padding-right:6px;"><%
if strSearch = "%" then
response.write "<a href=""browse.asp?display=" & strSearch & "25&page=" & iPageCurrent & "&sortby=NameCompany&sortorder=ASC"" class=""menu"">Company Name</a> / <a href=""browse.asp?display=" & strSearch & "25&page=" & iPageCurrent & "&sortby=Category&sortorder=ASC"" class=""menu"">Category</a>"
else
response.write "<a href=""browse.asp?display=" & strSearch & "&page=" & iPageCurrent & "&sortby=NameCompany&sortorder=ASC"" class=""menu"">Company Name</a> / <a href=""browse.asp?display=" & strSearch & "&page=" & iPageCurrent & "&sortby=Category&sortorder=ASC"" class=""menu"">Category</a>"
end if
%></div></td>
<td width="16%" height="100%" valign="top" align="left" valign="center" style="background-color: #4b4b4b; padding: 4px; margin: 0px auto; border: 0px solid #767676;"><div style="padding-top:3px;padding-bottom:3px;padding-left:6px;padding-right:6px;"><%
if strSearch = "%" then
response.write "<a href=""browse.asp?display=" & strSearch & "25&page=" & iPageCurrent & "&sortby=ContactTown&sortorder=ASC"" class=""menu"">Location</a>"
else
response.write "<a href=""browse.asp?display=" & strSearch & "&page=" & iPageCurrent & "&sortby=ContactTown&sortorder=ASC"" class=""menu"">Location</a>"
end if
%></div></td>
</tr></table>
</td>
</tr>
</table>
<table cellpadding="5" cellspacing="0" width="100%" height="3" bgcolor="#767676" align="center">
<tr><td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto;"></td></tr></table>
<%
Do While Not rstSearch.EOF And rstSearch.AbsolutePage = iPageCurrent
%>
<table cellpadding="0" cellspacing="0" width="100%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto; border: 0px solid #767676;">
<table cellpadding="0" cellspacing="0" width="99%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="10%" height="100%" valign="top" align="left" valign="center" style="background-color: #5B5A5A; padding: 0px; margin: 0px auto; border-top: 1px solid #767676; border-bottom: 1px solid #767676; border-left: 1px solid #767676; border-right: 1px solid #767676;"><%
dim fileName
fileName = rstSearch.Fields("NameCompany")
if fileName = "" or IsNull(fileName) then
response.write "<img src=""/network/images/small/no.gif"">"
else
response.write "<img src=""/network/images/small/" & fileName & ".gif"">"
end if
%></td>
<td width="74%" height="100%" valign="top" align="left" style="background-color: #5B5A5A; padding: 4px; margin: 0px auto; border-top: 1px solid #767676; border-bottom: 1px solid #767676; border-right: 0px solid #767676;">
<div style="padding-top:5px;padding-bottom:5px;padding-left:6px;padding-right:6px;">
<img src="/network/images/companyarrow.gif"> <a class="menu1" href="company.asp?view=viewcompany&ID=<%= rstSearch.Fields("ID").Value %>"><%= rstSearch.Fields("NameCompany").Value %></a> ( <a class="browse-category" href="/network/catselect.asp?category=<%= rstSearch.Fields("Category").Value %>"><%= rstSearch.Fields("Category").Value %></a> )<BR>
<%= rstSearch.Fields("DescriptionSmall").Value %><BR>
</div>
</td>
<td width="16%" height="100%" valign="center" align="left" valign="center" style="background-color: #5B5A5A; padding: 0px; margin: 0px auto; border-top: 1px solid #767676; border-bottom: 1px solid #767676; border-left: 1px solid #767676; border-right: 1px solid #767676;">
<div style="padding-top:5px;padding-bottom:5px;padding-left:6px;padding-right:6px;">
<a class="browse-category" href="/network/browse.asp?display=<%= rstSearch.Fields("ContactTown").Value %>"><%= rstSearch.Fields("ContactTown").Value %></a></div></td>
</tr></table>
</td>
</tr>
</table>
<table cellpadding="5" cellspacing="0" width="100%" height="3" bgcolor="#767676" align="center">
<tr><td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto;"></td></tr></table>
<%
rstSearch.MoveNext
Loop
%>
<table cellpadding="0" cellspacing="0" width="100%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto; border: 0px solid #767676;">
<table cellpadding="0" cellspacing="0" width="99%" height="2" bgcolor="#cccccc" align="center">
<tr>
<td height="100%" valign="top" align="left" style="background-color: #4b4b4b; padding: 4px; margin: 0px auto; border-bottom: 1px solid #5B5A5A;">
<div style="padding-top:1px;padding-bottom:1px;padding-left:1px;padding-right:1px;">
Displaying Page <font class="cpage"><%=iPageCurrent%> of <%=iPageCount%> </font>
</font>
</div>
</td>
<td height="100%" valign="top" align="right" style="background-color: #4b4b4b; padding: 4px; margin: 0px auto; border-bottom: 1px solid #5B5A5A;">
<div style="padding-top:1px;padding-bottom:1px;padding-left:1px;padding-right:1px;">
<%
' Now we need to show our navigation links:
' Show "previous" and "next" page links which pass the page to
' view our search parameter. You could also use form buttons
' but I find this looks better.
If iPageCurrent > 1 Then
%>
<img src="/network/images/previouspage.gif" border="0"> <a href="<%= strURL %>?display=<%= Server.URLEncode(strSearch) %>&page=<%= iPageCurrent - 1 %>&sortby=<%=ordervariable%>&sortorder=<%=sortorder%>" class="menu">Previous Page</a>
<%
End If
' You can also show page numbers:
For I = 1 To iPageCount
If I = iPageCurrent Then
%>
<img src="/network/images/pagedivider.gif" border="0">
<%
Else
%>
<%
End If
Next 'I
If iPageCurrent < iPageCount Then
%></font>
<a href="<%= strURL %>?display=<%= Server.URLEncode(strSearch) %>&page=<%= iPageCurrent + 1 %>&sortby=<%=ordervariable%>&sortorder=<%=sortorder%>" class="menu"> Next Page</a> <img src="/network/images/nextpage.gif" border="0">
</div>
</td>
</tr></table>
</td>
</tr>
</table>
<% End If %>
<%
End If
' Close our recordset and connection and dispose of the objects
rstSearch.Close
Set rstSearch = Nothing
cnnSearch.Close
Set cnnSearch = Nothing
End If
%>
<table cellpadding="5" cellspacing="0" width="100%" height="3" bgcolor="#767676" align="center">
<tr><td width="100%" valign="top" align="left" style="background-color: #4b4b4b; margin: 0px auto;"></td></tr></table>
</td>
<table cellpadding="0" cellspacing="0" width="780" height="2" bgcolor="#4b4b4b" align="center">
<tr>
<td width="100%" valign="top" align="left" style="background-color: #4b4b4b; padding: 4px; margin: 0px auto;">
<!--#include virtual="/network/footer.html"-->
</td>
</tr>
</table>
</div>
</body>
</html>