<%
Num_row=3 ' number of products placed per line
Rows=3 ' number of product lines placed
Maxpp=num_row*rows ' paging needs maxpp
Set Rs=server.createobject ("Adodb.recordset")
Sql= ' select * from Shop_books where nclassid= ' &nid& ' ORDER by adddate Desc '
Rs.Open sql,conn,1,1
If Rs.eof Then
Response. Write "No record!"
Else
Page=cint (Request ("page")
Strfilename= "Auction2.asp?lx=big&anid="
If not IsEmpty (Request ("page") Then
Currentpage=cint (Request ("page")
Else
Currentpage=1
End If
Totalput=rs.recordcount
if (currentPage-1) *maxpp>totalput Then
if (totalput mod maxpp) =0 Then
Currentpage=totalput \ MAXPP
Else
Currentpage=totalput \ maxpp + 1
End If
End If
If Currentpage=1 then (www.111cn.net)
Showcontent
ShowPage Totalput,maxpp,strfilename
Else
if (currentPage-1) *maxpp<totalput Then
Rs.move (currentPage-1) *maxpp
Showcontent
ShowPage Totalput,maxpp,strfilename
Else
Currentpage=1
Showcontent
ShowPage Totalput,maxpp,strfilename
End If
End If
End If
%>
<%sub showcontent%>
<table width= "100%" border= "0" align= "center" cellpadding= "0" cellspacing= "0" >
<%
J=1 ' Initialize J, whose value is the number of products displayed on the page
Do as not (rs.eof or err) ' when there is a record
if (J MoD num_row) =1 then Response.Write "<tr>" End If ' j is incremented starting from 1, starting to show 1 lines
%>
<TD width= "<%= (100/num_row)%>%" align=center> <table width=100 height=189 cellSpacing=1 Border=0>
<TBODY>
<TR>
<TD align=center><%if rs ("ta") = "" Then
Response.Write "<div align=center><a href=show.asp?id=" &rs ("BookID") & "></a></div> "
Else%>
<a href=show.asp?id=<%=rs ("BookID")%> ></a>
<%end if%> </td>
</tr>
<TR>
<TD height=26 bgcolor= #ffffff align=center><%
Response.Write Trim (RS ("BookName"))%></td>
</tr>
<TR>
<TD height=5 bgcolor= #ffffff align=center></td>
</tr>
</tbody>
</table> </td>
<%
if (J MoD num_row) =0 then Response.Write "</tr>" End If ' when the value of J is a multiple of the Num_row a row
J=j+1
If J>maxpp then Exit Do
Rs.movenext
Loop ' round it.
%>
<!--start: The following are the number of columns that are not replenished when the record is all displayed and the number of tables is not sufficient-->
<%
Dim k
k= (j-1) mod Num_row
If not (k=0) then
Response.Write "<td colspan=" & (num_row-k) & "Width=" & (CInt (100/num_row) * (num_row-k)) & ">& Nbsp;</td> "
Response.Write "</tr>"
End If
%><!--End-->
</table>
<%end sub%>
<%
function ShowPage (totalput,maxpp,filename)
Dim n
If Totalput mod maxpp=0 then
N=totalput \ MAXPP
Else
N=totalput \ Maxpp+1
End If
Response.Write "<form method=post action=" &filename& ">"
Response.Write ""
If Currentpage<2 Then
Response.Write "First prev "
Else
Response.Write "<a href=" &filename& "?page=1> home </a> "
Response.Write "<a href=" &anclassid& "page=" ¤tPage-1& "> Page </a> "
End If
If N-currentpage<1 Then
Response.Write "Next page last "
Else
Response.Write "<a href=" &filename& "page=" ¤tPage+1& "> next page </a> "
Response.Write "<a href=" &filename& "page=" &n& "> Last </a>"
End If
Response.Write "" ¤tPage& "/" &n& "page "
Response.Write "&MaxPP& Item/page"
End Function
%>