|
<%
Const MaxPerPage=10
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(SafeRequest("page",1)) then
currentPage=Cint(SafeRequest("page",1))
else
currentPage=1
end if
set rs=server.CreateObject("adodb.recordset")
if catid="" then
rs.open "select top 20 prename,company,mark,pretype,intro,other,type,viewnum,grade,predate,id,name,introduce,price1,price2,discount,productdate,pic from product order by adddate desc",conn,1,1
else
rs.open "select predate,prename,company,mark,pretype,intro,name,other,type,viewnum,grade,id,introduce,price1,price2,discount,productdate,pic from product where categoryid="&catid&" order by adddate desc",conn,1,1
end if
if err.number<>0 then
response.write "数据库中暂时无数据"
end if
if rs.eof And rs.bof then
Response.Write " 对不起,此分类暂时还没有商品! "
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"cat.asp"
else
if (currentPage-1)*MaxPerPage
<%
do while not rs.eof%>
|
<% = trim(rs("prename")) %>
><%=trim(rs("name"))%> |
<%=trim(rs("company"))%>:<%=trim(rs("mark"))%> |
<%=trim(rs("pretype"))%>:<%=trim(rs("type"))%> |
<%=trim(rs("intro"))%>:<%=trim(rs("introduce"))%> |
<%=trim(rs("predate"))%>:<%=trim(rs("productdate"))%> |
浏览次数:<%=trim(rs("viewnum"))%> |
<%=trim(rs("other"))%>:<%=trim(rs("grade"))%> |
市场价:¥<%=rs("price1")%>元 |
会 员 价:¥<%=rs("price2")%>元 |
折扣:<%=rs("discount")*10%>折 |
','','width=632,height=388,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');return false;">
|
&action=add','','width=632,height=388,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');return false;"> |
|
|
<%
i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing
%>
<%
End Sub
Function showpage(totalnumber,maxperpage,filename)
Dim n
If totalnumber Mod maxperpage=0 Then
n= totalnumber \ maxperpage
Else
n= totalnumber \ maxperpage+1
End If %>
|
|