|
<!--PRO Begin-->
<%sql="select * from products order by product_date desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write("Null")
else
rdcount=rs.recordcount
%>
<TABLE cellSpacing=0 cellPadding=0 width=190 border=0>
<TBODY>
<TR>
<%
for i=1 to rdcount
%>
<TD width=163>
<DIV align=center>
<TABLE cellSpacing=0 cellPadding=0 width="170" border=0>
<TBODY>
<TR>
<TD height=120 align="center"><A href="prod.asp?product_id=<%=rs("product_id")%>&type_id=<%=replace(rs("type_id"),"&","_")%>"><%=rs("type_id")%></A>
<P align=center><A href="prod.asp?product_id=<%=rs("product_id")%>&type_id=<%=replace(rs("type_id"),"&","_")%>"><IMG src="images/<%=rs("product_photo")%>" border=0 width=100></A></P></TD></TR>
<TR>
<TD height=25>
<P align=center><A class=small href="prod.asp?product_id=<%=rs("product_id")%>&type_id=<%=replace(rs("type_id"),"&","_")%>">
<span style="font-size: 8pt; text-decoration: none"><%=rs("product_num")%></span></A></P></TD></TR>
<TR>
<TD> <TR>
<TD>
<table border="0" width=150 cellspacing="0" cellpadding="0" align=center>
<tr>
<td bgcolor="#000000" height=1></td>
</tr>
</table></TD>
</TR>
<TR>
<TD height=10></TD>
</TR><%
sql="select top 5 * from products where type_id='"&type_id&"' and product_id<>"&rs("product_id")&" order by product_date desc"
rs2.open sql,conn,1,1
rdcount2=rs2.recordcount
for j=1 to rdcount2
%>
<TR>
<TD height=20><IMG style="margin-left:10px" src="images/arrow_blk.gif" border=0><A class=navsublinks
href="prod_detail.asp?product_id=<%=rs2("product_id")%>&type_id=<%=replace(rs2("type_id"),"&","_")%>"><%=rs2("product_num")%></A></TD>
</TR>
<%
rs2.movenext
next
rs2.close
%>
<TR>
<TD height=20><IMG style="margin-left:10px" src="images/arrow_blk.gif" border=0><A href="prod.asp?product_id=<%=rs("product_id")%>&type_id=<%=replace(rs("type_id"),"&","_")%>"><img src="images/view_all.gif" border=0></A></TD>
</TR>
</TD></TR>
</TBODY></TABLE></DIV></TD>
<TD width=27 valign="top">
<table border="0" width="1" id="table1" cellspacing="0" cellpadding="0" bgcolor="#000000" height=140 align=center>
<tr>
<td bgcolor="#FFFFFF" width=1 height="7"></td>
</tr>
<tr>
<td></td>
</tr>
</table>
</TD>
<%
rs.movenext
if i mod 3=0 then response.write("</tr><tr><td height=30></td></tr><TR>")
next
end if
rs.close
%>
</TR>
</TBODY></TABLE>
<!--PRO End-->
上面是页面的循环部分的代码
请前辈指点
如何让每个type_id只出现一次 |
|