<table width="110" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><%
    'id=Request("id")
sql="select * from newsinfo where catalogid=36 ORDER BY pubtime DESC"
Set Rs=GetRecordSet(sql)
If Not Rs.Eof Then 
    title=Rs("title")
isHtml=Rs("isHtml")
    content=Rs("content")
viewtimes=Rs("viewtimes")
pubtime=Rs("pubtime")
' 如果不是html源文件,需要编码后再显示
If isHtml=0 Then 
    content=Replace(content,vbCrLf,"<br>")
conent=Replace(content,chr(32),"&nbsp;")
End If
id=Rs("id") 
Rs.Close
end if
Dim imgArray1(20),fileArray1(20)
sql="select * from image where newsid="&id
Set Rs=GetRecordSet(sql)
m=0
m=0
While Not Rs.Eof
    If Rs("filetype")=0 Then 
    imgArray1(m)=Rs("fileurl")
m=m+1
Else
    fileArray1(n)=Rs("fileurl")
n=n+1
End If 
Rs.MoveNext
Wend
Rs.Close
  %>
              <%For m=0 To Ubound(imgArray1)-1
    If imgArray1(m)<>"" Then 
           Response.write "<center><img width='130' height='100' src='file/"&imgArray1(m)&"'></center><br>"
End If 
  Next 
%></td>
                  </tr>
                  <tr>
                    <td><a href="detail.asp?id=<%=id%>"><%=title%></td>
                  </tr>
                </table>
这段代码是正确的,能显示最新的一个图片。我想一行显示4张图片从数据库中提取最新的四条数据。谢谢

解决方案 »

  1.   

    大家帮解决阿 ,第一次发贴,以后有分一定送上!谢谢,
      

  2.   

    讨厌前置代码。
    一个图片的话需要2个变量。
    要是N个图片循环的话,光写变量也很累。为什么不使用模板列?
      

  3.   

    讨厌前置代码。
    一个图片的话需要2个变量。
    要是N个图片循环的话,光写变量也很累。为什么不使用模板列?