ASP cyclic row number Output function _ Application techniques

Source: Internet
Author: User
After the Big Bird's guidance has made comprehensive changes, I limited ability can only do the following this step:

Asp/visual Basic code
Copy Code code as follows:

<%
Const p=6 ' every page 2 piece
Set rs = Server.CreateObject ("Adodb.recordset")
sql = "SELECT * from show order by ID Desc"
Rs. Open sql,conn,1

I=0
Do as not rs.eof
%> <td align= "center" height= ">"
<a href= "show.asp?id=<%=rs (" id ")%>" >
</a> "
</td>
<%
If (i+1) Mod 3 =0 Then
Response.Write "</tr>"
If i< (p-1) Then Response.Write "<tr>"
End If
I=i+1
If I>p then Exit Do
Rs.movenext
Loop
If I Mod 3 <>0 Then
For m=3-(I Mod 3) to 1 Step-1
Response.Write "<td> </td>"
Next
Response.Write "</tr>"
End If
If i = 3 Then
Response.Write "<td> </td><td> </td><td> </td></tr>"
End If
Rs.close
Set rs=nothing
%>



The previous code has not changed

Copy Code code as follows:

<%
Const p=6 ' every page 2 piece
Set rs = Server.CreateObject ("Adodb.recordset")
sql = "SELECT * from show order by ID Desc"
Rs. Open sql,conn,1

I=1
Do as not rs.eof
%> <td align= "center" height= ">"
<a href= "show.asp?id=<%=rs (" id ")%>" >
</a> "
</td>
<%
If I mod 3 = 0 Then
Response.Write ("</tr><tr>")
End If
I=i+1
If I>p then Exit Do
Rs.movenext
Loop
Rs.close
Set rs=nothing
%>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.