|
在做网站购物车功能时,经常需要显示访客最近浏览过的产品,这里给出一个方法,希望对大家以后的网站设计有帮助:
<%’最近游览 session("Recently_view")=id&","&session("Recently_view") ’去掉重复浏览 str=session("Recently_view") Arraystrs = split(str,",",-1) intNumstrs=UBound(Arraystrs)-LBound(Arraystrs) For i=0 To intNumstrs-1 y=0 for x=i to intNumstrs-1 if Arraystrs(i)=Arraystrs(x) and i <> x then y=1 end if next if y=0 then mmstr=mmstr&","&Arraystrs(i) end if next mmstr=right(mmstr,len(mmstr)-1) ’session("Recently_view")="" Set Rsrv=Server.CreateObject("ADODB.Recordset") sqlrv="Select top 4 id,title from download where id in ("&mmstr&") order by id desc" rsrv.open sqlrv,conn,1,1 do while not rsrv.eof response.write "<a href=’view.asp?id="&rsrv("id")&"’>"&rsrv("title")&"</a>" rsrv.movenext loop rsrv.close set rsrv=nothing%>
【2010-08-26】 【浏览112次】
上一篇:做网站时常用到的正则表达式
下一篇:网奇iwms破解(去掉底部版权信息)
|