The ASP reads the data horizontally and lists three records in one row

Source: Internet
Author: User
Tags exit end
Data method One:

<table width= "100%" align= "Center" >
<%for I=1 to Rs.recordcount
if (i mod 3=1) then
Response.Write "<tr>"
End If
Response.Write "<td>" &rs ("XXX") & "</td>"
if (i mod 3=0) then
Response.Write "</tr>"
End If
Rs.movenext
Next%>
</table>

Code at a glance, focusing on line seventh----if (i mod 3=0) then
Here are 3 columns, if you want to line up more or less, you can modify it yourself.

Method Two:

<%set Rs=server. CreateObject ("Adodb.recordset")
SQL = "SELECT * from Shop_books ORDER by Adddate Desc"
Rs.Open sql,conn,1,1
%>
<tr>
<td>
<table width= "193" border= "0" cellpadding= "5" cellspacing= "0" >
<tr>
<% Dim J
J=0
Do as not rs.eof%>
&LT;TD width= "193" >
<table width= "border=" 0 "cellpadding=" 3 "cellspacing=" 0 ">
<tr>
&LT;TD width= "163" ><a href=list03.asp?id=<%=rs ("BookID")%>> "width=" 140 "height=" border= "0" class= "Blue" ></a></td>
</tr>
<tr>
&LT;TD valign= "Top" ><a href= list.asp03?id=<%=rs ("BookID")%> "class=" Word-red13-bold "><%=Rs" (" BookName ")%></a><br>
<%=rs ("Bookcontent")%><br> <br> <span class= "WORD-GREY12" > Market Price: <%=rs ("Shichangjia")% > Yuan <br>
Member Price: <%=rs ("Huiyuanjia")%> yuan <br>
VIP Price: <%=rs ("Vipjia")%> yuan </span></td>
</tr>
<tr>
&LT;TD height= ">"
<div align= "right" ></div>
<div align= "Right" >
<table width= "90%" border= "0" align= "left" cellpadding= "0" cellspacing= "0" >
<tr>
<td><div align= "right" ><a href= "Gouwu.asp?id=<%=rs (" BookID ")%>&action=add" ></a>
<a href= "Shoucang.asp?id=<%=rs (" BookID ")%>&action=add" ></a>
</div></td>
</tr>
</table>
</div></td>
</tr>
</table>
</td>
<% Rs.movenext
J=j+1
If Rs.eof Then
Exit Do
End If
If J>=3 then Exit Do
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.