When PHP programmers write program code, they usually use the pagination function. The code is actually the same as writing WORD documents. Next, let the editor of the Error New Technology take you to learn about the methods of programmers writing pagination functions. The code copy is as follows:
<%
page=trim(request("page"))
mapperpage=40
first=true
last=true
dim rs
set rs=server.CreateObject("adodb.recordset")
sql="select id,title,add1,cartype,isred,enterdate,hits from news where classtype=0 and pass=1 order by id desc"
rs.open sql,conn,1,1
rs.pagesize=maxperpage
Totalpage=rs.pagecount
if len(page)=0 then
intpage=1
first=false
else
if cint(page)<=1 then
intpage=1
first=false
else
if cint(page)>=rs.pagecount then
intpage=rs.pagecount
last=false
else
intpage=cint(page)
end if
end if
end if
if not rs.eof then
rs.absolutepage=intpage
end if
for a=1 to mapperpage
if rs.eof then exit for
%>
else
response.write "bgcolor=#f6f6f6"
end if
%>>
<%=a%>
<%add=rs("add1")
substring add,4
%>
" target="_blank">
<%
if rs("isred")=True then
%>
<%title=rs("title")
Substring title,20
%>
<%else
title=rs("title")
Substring title,20
%>
<%
end if
%>
<%=rs("cartype")%>
<%thetime=rs("enterdate")
them=datepart("m",thetime)
if len(themon)<2 then themon="0"&themon
theday=datepart("d",thetime)
if len(theday)<2 then theday="0"&theday
ther=themon&"-"&theday
response.write the
%>
<%=rs("hits")%>
<%
rs.movenext
if rs.eof then exit for
next
%>
<%if rs.pagecount>0 then %>
There are a total of <%=rs.recordcount%> | Current page <%=intpage%>/
<%
=rs.pagecount%>
<% end if %>
<%if intpage>1 then%>
?
page=1">Home Page
<%else%>
front page
<%end if%>
<%if first then%>
?
page=<%=intpage-1%>">Previous page
<%else%>
Previous page
<%end if%>
<%if last and intpage
?
page=<%=intpage+1%>">Next page
<%else%>
Next page
<%end if%>
<%if intpage
?
page=<%=rs.pagecount%>">Last page
<%else%>
Last page
<%end if%>
Go to
[this.selectedIndex].value">
<%for b=1 to rs.pagecount
if b=intpage then%>
?page=<%=b%>" selected>
Page <%=b%>
<% else %>
?page=<%=b%>">Page <%=b%>
<%end if
next%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%> > then%> > then%> > > >
Through the editor of the Error New Technology Channel, I believe everyone has a certain understanding of the methods of programmers writing paging functions. If you need to know more related information, please continue to pay attention to the Error New Technology Channel!