<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% ' Kashi Mighty Bites Polls ' Written by Jonathan Beck for EVB.com ' ' poll.asp - Displays the current poll, also has a list of polls and prev/next buttons dim oPoll dim rs, i, iCurrPoll dim iNextPollID, iPrevPollID set oPoll = new cPoll set rs = oPoll.LoadList() ' the iCurrPoll variable will help us determine which poll to print, and to make prev/next buttons iCurrPoll = Request("pollID") ' if we do not have a current poll, load the default poll if Len(iCurrPoll) < 1 then iCurrPoll = oPoll.Load() else ' this step makes sure the iCurrPoll is valid iCurrPoll = oPoll.LoadID(iCurrPoll) end if ' determine the next and previous pollIDs for Prev/Next Buttons, they default to 0 if rs.RecordCount > 0 Then do while (Not rs.EOF) ' if we are at the current poll if CLng(iCurrPoll) = CLng(rs.fields("iPollID")) then ' find the next poll and if it exists, set the next poll ID rs.MoveNext if not rs.EOF then iNextPollID = rs.fields("iPollID") rs.MoveLast rs.MoveNext end if ' not at current poll, set prev poll id and move on else iPrevPollID = rs.fields("iPollID") rs.MoveNext end if loop rs.MoveFirst ' done looping, go back to start end if rs.close set rs=nothing %> Kashi® Mighty Bites™
<% ' Check to see if we have prev/next poll IDs and make the buttons if we do if Len(iPrevPollID) > 0 then %> <% else %> <% end if if Len(iNextPollID) > 0 then %> <% end if %>