Programme I
Copy Code code as follows:
<!--#include file= "conn.asp"-->
<%
Owen1=request ("Owen1")
Owen2=request ("Owen2")
%>
<table width= "border=" 0 "cellpadding=" 0 "cellspacing=" 0 ">
<%
PAGE=CLNG (Request ("page")
Set rs=server.createobject ("ADODB. RecordSet ")
If owen1<> "" and Owen2 <> "" Then
Sql= "SELECT * from news where bigclassname= '" "&owen1&" ' and Smallclassname= ' "&owen2& ' ORDER by id DESC"
Rs. Open sql,conn,1,1
ElseIf owen1<> "" Then
Sql= "SELECT * from news where bigclassname= '" &owen1& "' ORDER BY id DESC"
Rs. Open sql,conn,1,1
End If
If rs.eof and Rs.bof then
Response. Write ("not recorded for the moment")
Else
%>
<%
Rs. Pagesize=15
If Page=0 then page=1
Pages=rs.pagecount
If page > pages then page=pages
Rs. Absolutepage=page
For J=1 to Rs. PageSize
if (j-1) mod 3=0 Then Response.Write ("<tr>")
%>
<TD height= "align=" "Center" >
<div align= "center" > "width=" 130 "height=" "border=" "0"/ ><a href= "onews.asp?id=<%= RS (" id ")%>" target= "_blank" ><br>
<%= RS ("TITLE")%></a></div></td>
<%
If J MoD 3=0 then Response.Write ("</tr>")
Rs.movenext
If Rs.eof then exit for
Next
%>
<%
End If
Rs.close
Set rs=nothing
%>
</table>
Programme II,
Copy Code code as follows:
<!--#include file= "conn.asp"-->
<%
Owen1=request ("Owen1")
Owen2=request ("Owen2")
%>
<table width= "border=" 0 "cellpadding=" 0 "cellspacing=" 0 ">
<%
PAGE=CLNG (Request ("page")
Set rs=server.createobject ("ADODB. RecordSet ")
If owen1<> "" and Owen2 <> "" Then
Sql= "SELECT * from news where bigclassname= '" "&owen1&" ' and Smallclassname= ' "&owen2& ' ORDER by id DESC"
Rs. Open sql,conn,1,1
ElseIf owen1<> "" Then
Sql= "SELECT * from news where bigclassname= '" &owen1& "' ORDER BY id DESC"
Rs. Open sql,conn,1,1
End If
If rs.eof and Rs.bof then
Response. Write ("not recorded for the moment")
Else
%>
<%
Rs. Pagesize=15
If Page=0 then page=1
Pages=rs.pagecount
If page > pages then page=pages
Rs. Absolutepage=page
For J=1 to (Rs. PAGESIZE/3)
Response.Write ("<tr>")
For I=1 to 3
%>
<TD height= "align=" "Center" >
<div align= "center" > "width=" 130 "height=" "border=" "0"/ ><a href= "onews.asp?id=<%= RS (" id ")%>" target= "_blank" ><br>
<%= RS ("TITLE")%></a></div></td>
<%
Rs.movenext
If Rs.eof then exit for
Next
Response.Write ("</tr>")
Next
%>
<%
End If
Rs.close
Set rs=nothing
%>
</table>
The code above has drawbacks.
That is, if it's 16, then the last line of the page is empty. Two columns page It's hard to see because if 16 of the last row shows only one column, this is less than two <td> </td>
Must be judged by total/3 remainder
if (rs.recordcount mod 3=2) Then Response.Write ("<td> </td>")
if (rs.recordcount mod 3=1) Then Response.Write ("<td> </td><td> </td>")
So the page is complete