<% Option Explicit %> <% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Guide - Web Wiz Journal '** '** Copyright 2001-2002 Bruce Corkhill All Rights Reserved. '** '** This program is free software; you can modify (at your own risk) any part of it '** under the terms of the License that accompanies this software and use it both '** privately and commercially. '** '** All copyright notices must remain in tacked in the scripts and the '** outputted HTML. '** '** You may use parts of this program in your own private work, but you may NOT '** redistribute, repackage, or sell the whole or any part of this program even '** if it is modified or reverse engineered in whole or in part without express '** permission from the author. '** '** You may not pass the whole or any part of this application off as your own work. '** '** All links to Web Wiz Guide and powered by logo's must remain unchanged and in place '** and must remain visible when the pages are viewed unless permission is first granted '** by the copyright holder. '** '** This program is distributed in the hope that it will be useful, '** but WITHOUT ANY WARRANTY; without even the implied warranty of '** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER '** WARRANTIES WHETHER EXPRESSED OR IMPLIED. '** '** You should have received a copy of the License along with this program; '** if not, write to:- Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom. '** '** '** No official support is available for this program but you may post support questions at: - '** http://www.webwizguide.info/forum '** '** Support questions are NOT answered by e-mail ever! '** '** For correspondence or non support questions contact: - '** info@webwizguide.com '** '** or at: - '** '** Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom '** '**************************************************************************************** Dim rsJournal 'Database recordset holding the Journal items Dim rsCommentsCount 'Database recordset holding the count of comments for each Journal item Dim intRecordPositionPageNum 'Holds the number of the page the user is on Dim intRecordLoopCounter 'Loop counter to loop through each record in the recordset Dim intTotalNumJournalEntries 'Holds the number of Journal Items there are in the database Dim intTotalNumJournalPages 'Holds the number of pages the Journal Items cover Dim intLinkPageNum 'Holds the number of the other pages of Journal itmes to link to 'If this is the first time the page is displayed then set the record position is set to page 1 If Request.QueryString("PagePosition") = "" Then intRecordPositionPageNum = 1 'Else the page has been displayed before so the Journal item record postion is set to the Record Position number Else intRecordPositionPageNum = CInt(Request.QueryString("PagePosition")) End If %> StudyPrep <% 'Create recorset object Set rsJournal = Server.CreateObject("ADODB.Recordset") 'Initalise the strSQL variable with an SQL statement to query the database strSQL = "SELECT tblJournal.* FROM tblJournal ORDER BY Date_stamp DESC;" 'Set the cursor type property of the record set to dynamic so we can naviagate through the record set rsJournal.CursorType = 3 'Query the database rsJournal.Open strSQL, adoCon 'Set the number of records to display on each page by the constant set in the common.asp file rsJournal.PageSize = intRecordsPerPage 'Get the record poistion to display from If NOT rsJournal.EOF Then rsJournal.AbsolutePage = intRecordPositionPageNum 'Create recorset object Set rsCommentsCount = Server.CreateObject("ADODB.Recordset") 'If there are no rcords in the database display an error message If rsJournal.EOF Then 'Tell the user there are no records to show Response.Write "
There are no Journal Items to read" Response.Write "
Please check back later
" Response.End 'Display the Journal Items Else 'Count the number of Journal Items database intTotalNumJournalEntries = rsJournal.RecordCount 'Count the number of pages of Journal Items there are in the database calculated by the PageSize attribute set above intTotalNumJournalPages = rsJournal.PageCount 'Display the HTML number number the total number of pages and total number of records %> <% 'For....Next Loop to display the Journal Items in the database For intRecordLoopCounter = 1 to intRecordsPerPage 'If there are no records then exit for loop If rsJournal.EOF Then Exit For 'Get the count of comments from the db strSQL = "SELECT Count(tblComments.Journal_ID) AS CountOfJournalItems " strSQL = strSQL & "FROM tblComments " strSQL = strSQL & "WHERE tblComments.Journal_ID = " & CLng(rsJournal("Journal_ID")) & ";" 'Query the database rsCommentsCount.Open strSQL, adoCon %>
<% = rsJournal("Journal_title") %>
<% = rsJournal("Journal_item") %>

<% 'Close the count recordset rsCommentsCount.Close 'Move to the next record in the recordset rsJournal.MoveNext Next End If 'Display an HTML table with links to the other Journal Items %>
<% 'If there are more pages to display then add a title to the other pages If intRecordPositionPageNum > 1 or NOT rsJournal.EOF Then Response.Write vbCrLf & " Page: " End If 'If the Journal Items page number is higher than page 1 then display a back link If intRecordPositionPageNum > 1 Then Response.Write vbCrLf & " << Prev " End If 'If there are more pages to display then display links to all the pages If intRecordPositionPageNum > 1 or NOT rsJournal.EOF Then 'Display a link for each page in the Journal Items For intLinkPageNum = 1 to intTotalNumJournalPages 'If the page to be linked to is the page displayed then don't make it a hyper-link If intLinkPageNum = intRecordPositionPageNum Then Response.Write vbCrLf & " " & intLinkPageNum Else Response.Write vbCrLf & " " & intLinkPageNum & " " End If Next End If 'If it is Not the End of the Journal Items entries then display a next link for the next Journal Items page If NOT rsJournal.EOF then Response.Write vbCrLf & " Next >>" End If 'Finsh HTML the table %>

Admin



<% 'Reset server objects rsJournal.Close Set rsJournal = Nothing Set rsCommentsCount = Nothing Set strCon = Nothing Set adoCon = Nothing %>