页面导航: 首页网络编程ASP编程应用技巧 → 正文内容 记录横向

从数据库中读取记录横向排列

发布:dxy 发布日期:2008-4-8 20:31:45 字体:[增加 减小] 类型:转载
在一张网页如果按以下代码从数据库中读取记录,
 <table width="100%" border="0" cellpadding="0" cellspacing="0">    
<% do while not rs.eof %>
    <tr>
       <td height="80"><img src="<%= rs("图片")%>" width="160" height="80"></td>      
    </tr>
<% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</table>
记录排列如下:
1
2
3
4
5
如果我想把记录排列改成
1  2  3
4  5
那么以上代码该怎么改,请高手帮忙一下

<table width="100%" border="0" cellpadding="0" cellspacing="0">    
<%   i=0   
  do while not rs.eof 
  if i mod 3 =0 then %>
  <tr>   
  <% end if %>
     <td height="80"><img src="<%= rs("图片")%>" width="160" height="80"></td>      
  <% 
  if (i+1) mod 3=0 then
  %>
  </tr>
  <%end if%>   
  <%   
  i=i+1
  if i>=MaxPerPage then exit do 
  rs.movenext   
  loop  
  %>  
</table>
百度中搜索更多的关于从数据库中读取记录横向排列内容,或者用Google搜索相关更多
浏览次数:载入中... 打印本文关闭本文返回首页

文章评论

共有 位脚本之家网友发表了评论我来说两句

同 类 文 章
最 近 更 新
热 点 排 行