<%@LANGUAGE="VBSCRIPT"%> <% '============================================================================ ' Action : New code/functionality (Previous code had to be rewritten) ' Company : Seniorboys ' Contact Info : www.seniorboys.com - 01708 857931 ' Author : Kenny Oduyeye ' Description : New Functionality used in retrieving ' data entered by user into the Name, Business Type and ' City fields. Search criteria uses wildcard search ' for minimum criteria entered. ' Date : March 2003 '============================================================================ %> Praiselink.com


Artist of the Month:

Praiselink's Artist of the Month The Tribe


Add Your Business
Register
Charities
Help & Advice


Download
About Us
Contact Us

 

 

- your gateway to a life of praise!!!
 
If you would like to add your business details, please click here
<% '============================================================================ ' Action : New code/functionality ' Company : Seniorboys ' Contact Info : www.seniorboys.com - 01708 857931 ' Author : Kenny Oduyeye ' Description : Added new local variables used in retrieving ' data entered by user into the Name, Business Type and ' City fields. Search criteria uses wildcard search ' for minimum criteria entered. ' Date : March 2003 '============================================================================ Dim myConstring myConstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "\my_db\praiselink.mdb;" 'Set how many records we want per page '===================================== Const NumPerPage = 6 'Retrieve what page we are currently on '====================================== Dim curPage If Request.QueryString("curpage") = "" Then curpage = 1 Else curpage = Request.QueryString("curpage") End If Dim oRs1, strSql, strName, strCategory, strCity strName = Request("name") 'Kenny Oduyeye - New local variables declared March 2003 strCategory = Request("category") 'Kenny Oduyeye - New local variables declared March 2003 strCity = Request("city") 'Kenny Oduyeye - New local variables declared March 2003 '========================================================== 'Kenny Oduyeye March 2003 - Addition of new search criteria 'If Name, Category or City is entered, set query criteria '========================================================== if strName <> "" then strSql = "Status = 'publish' And BusinessName like" + chr(39) + trim(strName) + "%" + chr(39) strurl = "&name=" & trim(strName) elseif strCategory <> "" then strSql = "Status = 'publish' And Category like" + chr(39) + trim(strCategory) + "%" + chr(39) strUrl = "&category=" & trim(strCategory) elseif strCity <> "" then strSql = "Status = 'publish' And City like" + chr(39) + trim(strCity) + "%" + chr(39) strUrl = "&city=" & trim(strCity) else strSql = "" end if '========================================== 'Kenny Oduyeye March 2003 - End Of New code '========================================== %> <% if strName <> "" Or strCategory <> "" Or strCity <> "" then set oRs1 = Server.CreateObject("ADODB.Recordset") oRs1.ActiveConnection = myconstring 'Set the cursor location property '================================ oRs1.CursorLocation = adUseClient 'Set the cache size to the number of records per page '==================================================== oRs1.CacheSize = NumPerPage 'Open our recordset '================== oRs1.Source = "SELECT businessname, businessaddress1, businessaddress2, city, postalcode, telephone, category, firstname, website, emailaddress FROM business_listings WHERE " + strsql + " ORDER BY BusinessName ASC" oRs1.Open If Not oRs1.EOF Then oRs1.MoveFirst oRs1.PageSize = NumPerPage 'Get maximum number of pages '=========================== Dim TotalPages TotalPages = oRs1.PageCount 'Set the absolute page '===================== oRs1.AbsolutePage = CurPage 'Counting variable for our recordset '=================================== Dim Count 'Set Count equal to zero '======================= Count = 0 Dim Repeat1__numRows Repeat1__numRows = 6 Dim Repeat1__index Repeat1__index = 0 oRs1_numRows = oRs1_numRows + Repeat1__numRows If Not oRs1.EOF And Count < oRs1.PageSize Then %>


Search for Businesses by Name/Type/County

Business Name:
Business Type:
City/County:
    

<% End If %> <% Do while Not oRs1.EOF And Count < oRs1.PageSize IF (Repeat1__numRows MOD 2) <> 0 THEN Response.write " <% end if Repeat1__index = Repeat1__index + 1 Repeat1__numRows = Repeat1__numRows - 1 Count = Count + 1 oRs1.MoveNext Loop %> <% End if End If %>
Businesses
" else Response.Write "
" end if %> <%=(oRs1.Fields.Item("Businessname").Value)%>
<%=(oRs1.Fields.Item("BusinessAddress1").Value)%>
<%=(oRs1.Fields.Item("BusinessAddress2").Value)%>
<%=(oRs1.Fields.Item("City").Value)%>
<%=(oRs1.Fields.Item("PostalCode").Value)%>
Telephone:  <%=(oRs1.Fields.Item("Telephone").Value)%>
Business Type:  <%=(oRs1.Fields.Item("Category").Value)%>
Contact Name:  <%=(oRs1.Fields.Item("Firstname").Value)%>
Website:  ')"><%=(oRs1.Fields.Item("Website").Value)%>
Email:  "><%=(oRs1.Fields.Item("Emailaddress").Value)%>
<% IF (Repeat1__numRows MOD 2) <> 0 THEN %>

 
Results:   <% 'Print out the current page # / total pages '========================================== Response.Write("" & "Page " & CurPage & " of " & TotalPages & "

") 'Display Next and Previous Buttons '================================= If CurPage > 1 Then 'We are not at the begining, show the previous button '==================================================== Response.Write "<<- Prev " End If If CInt(CurPage) <> CInt(TotalPages) Then 'We are not at the end, show the next button '=========================================== Response.Write "Next ->> " End If %>