如何控制首页不重复显示同一客户发布的产品
求助:我做了分类网,客户可以发布自己的产品,我在首页做了个显示客户发布产品的图片信息,但一个客户一次发的多个产品都会显示出来,如何解决?
页页代码是:
<META http-equiv=Content-Type content="text/html; charset=gb2312"> <!--最新图文代码开始-->
<script language="JavaScript">
<!--
var flag=false;
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 122/100){
if(image.width>122){
ImgD.width=122;
ImgD.height=100;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt="点击查看详细信息...";
}
else{
if(image.height>100){
ImgD.height=100;
ImgD.width=122;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt="点击查看详细信息...";
}
}
}
//-->
</script>
<%
Const New_img=15
set rs_Products=server.createobject("adodb.recordset")
sqltext="select top " & New_img & " * from product_pic order by date desc"
rs_Products.open sqltext,conn,1,1
if not rs_Products.EOF then
%>
<div align='center' id='demo' style='overflow:hidden;height:140px;width:570px;'><!--滚动区的高度和宽度-->
<table align='center' cellpadding='0' cellspace='0' border='0'>
<tr>
<td id='demo1' valign='top'>
<table width='100%' cellpadding='0' cellspacing='0' border='0' align='center'>
<tr valign='top'>
<%
while not rs_Products.EOF
userid=rs_Products("userid")
%>
<%
set rs_c=server.createobject("adodb.recordset")
sql_c="select * from company where userid='"&userid&"' "
rs_c.open sql_c,conn,1,1
%>
<td align='center'>
<TABLE width=100% border=0 align=center cellPadding=0 cellSpacing=0>
<TR>
<TD width=8 rowspan=3 > </TD>
<TD vAlign=top><img src="img/pruct_1.gif" width="136" height="8" /></TD>
<TD width=7 rowspan=3 vAlign=top> </TD>
</TR>
<TR>
<TD height="85" background='img/pruct_2.gif'>
<a href='0795mp/company_mingpian.asp?id=<%=trim(rs_c("id"))%>&typename=<%=trim(rs_c("typename"))%>' target=_blank title='<%=rs_Products("product_name")%>'>
<img src="uppic/product/<%=rs_Products("pic")%>" alt="<%=rs_Products("product_name")%>" width="122" height="112" hspace="7" border="0" onload="javascript:DrawImage(this);">
</a> </TD>
</TR>
<TR>
<TD><img src="img/pruct_3.gif" width="136" height="8" /></TD>
</TR>
<TR>
<TD> </TD>
<TD align=center valign='top'><a href='uppic/product/<%=rs_Products("pic")%>' target="_blank" title='<%=rs_Products("product_name")%>'><%=left(rs_Products("product_name"),8)%></a></TD>
<TD> </TD>
</TR>
</TABLE>
</td>
<%
rs_Products.MoveNext
wend
%>
</tr>
</table>
</td>
<td id=demo2 valign=top></td>
</tr>
</table>
</div>
<%if New_img >5 then%>
<script>
var Picspeed=1
demo2.innerHTML=demo1.innerHTML
function Marquee1(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar1=setInterval(Marquee1,Picspeed)
demo.onmouseover=function() {clearInterval(MyMar1)}
demo.onmouseout=function() {MyMar1=setInterval(Marquee1,Picspeed)}
</script>
<%end if
else
Response.Write "暂 无 最 新 图 文"
end if
rs_Products.close
set rs_Products=nothing
rs_c.close
set rs_c=nothing
%>
<!--最新图文代码结束-->