<%
' Define variables
dim recordsonpage, requestrecords, offset, allrecords, hiddenrecords, showrecords, lastrecord, recordcounter, pagelist, pagelistcounter
lorr = "r"
' DB connection
dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open dsnstr
' records per page
recordsonpage = 5
' count all records
allrecords = 0
set r = Conn.Execute ("select count(*) from missingperson")
'Response.Write r(0)
set rs = conn.Execute("SELECT * FROM missingperson")
do until rs.EOF
allrecords = allrecords + 1
rs.movenext
loop
' if offset is zero then the first page will be loaded
offset = request.querystring("offset")
if offset = 0 OR offset = "" then
requestrecords = 0
else
requestrecords = requestrecords + offset
end if
' opens database
set rs = conn.Execute("SELECT * FROM missingperson")
' reads first records (offset) without showing them (can't find another solution!)
hiddenrecords = requestrecords
do until hiddenrecords = 0 OR rs.EOF
hiddenrecords = hiddenrecords - 1
rs.movenext
if rs.EOF then
lastrecord = 1
end if
loop
%>
Missing persons
We request all citizens , if you find any one of
missing persons please contact corresponding police station.
<%
' prints records in the table
showrecords = recordsonpage
recordcounter = requestrecords
do until showrecords = 0 OR rs.EOF
recordcounter = recordcounter + 1
%>
<%
if ( lorr = "r") then ' r photo & l info
call displayphoto
call displayinfo
lorr = "l"
else ' r info & l photo
call displayinfo
call displayphoto
lorr = "r"
end if %>
<%
showrecords = showrecords - 1
rs.movenext
if rs.EOF then
lastrecord = 1
end if %>
<% loop %>
<% if requestrecords <> 0 then %>Prev Page<% else %>Prev Page<% end if %>
<% if lastrecord <> 1 then %> Next Page<% else %>Next Page<% end if %>