说明:有2个表 电影信息表movie 电影地址表movieurl 地址表中有每集影片价格,目的为:要列出影片地址价格为0的电影信息
<%
set Rss= Server.CreateObject("ADODB.Recordset")
SQL="SELECt distinct MovieId FROM MovieUrl where MovieShowYes=1 And Price=0 ORDER BY MovieId ASC" '找出价格为0的电影地址ID,Price为价格
rss.open sql,conn,1,3
If rss.Eof Or rss.Bof Then
Response.Write " 对不起!暂时没有免费影片"
Else
do while not rss.EOF
MovieIdd=rss("MovieId") '得到价格为0的影片地址对应的电影ID
ii=0
set Rs= Server.CreateObject("ADODB.Recordset")
Sql = "SELECt MovieTitle,ID,MovieTime,MovieImgs,MovieContent,MovieZhuyan,MovieHits,MovieArea,MovieClass,MovieHits"
Sql = Sql & " FROM Movie"
Sql = Sql & " Where MovieShowYes=1 and ID = " &MovieIdd
Sql = Sql & " Order By MovieTime Desc" '列出电影免费地址ID的电影信息
rs.open sql,conn,1,3
if rs.eof and rs.bof then
response.write "<p align='center'> 该栏目没有任何电影</p>"
response.end
else
totalPut=rs.recordcount
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
if MaxPerPage*currentPage-totalPut<0 then
tt=0
else
tt=MaxPerPage*currentPage-totalPut
end if
showpage totalput,MaxPerPage,"sort.asp"
showContent
showpage1 totalput,MaxPerPage,"sort.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
if MaxPerPage*currentPage-totalPut<0 then
tt=0
else
tt=MaxPerPage*currentPage-totalPut
end if
rs.move (currentPage-1)*MaxPerPage
bookmark=rs.bookmark
showpage totalput,MaxPerPage,"sort.asp"
showContent
showpage1 totalput,MaxPerPage,"sort.asp"
else
currentPage=1
if MaxPerPage*currentPage-totalPut<0 then
tt=0
else
tt=MaxPerPage*currentPage-totalPut
end if
showpage totalput,MaxPerPage,"sort.asp"
showContent
showpage1 totalput,MaxPerPage,"sort.asp"
end if
end if
end if
rss.MoveNext
loop
ii=ii+1
end if
sub showContent
'Split("Sun,Mon,Tue,Wed,Thu,Fri,Sat",",")
BgImg1 = "06,04,08,09"
BgImg2 = "12,11,14,15"
dim i
i=0
%>
<%if session("s8")=2 then%>
<!--#include file="wz.asp"-->
<%else%>
<!--#include file="tp.asp"-->
<%end if%>
<TABLE width="100%" height="3" border=0 cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD bgcolor="#9966FF"></TD>
<TD bgcolor="#FF66CC"></TD>
<TD bgcolor="#0099CC"></TD>
</TR>
</TBODY>
</TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD width="14"><IMG height=44 src="havod/img/menu_top_r1_c1.gif"
width=14></TD>
<TD background=havod/img/menu_top_r1_c2.gif><table border="0" cellPadding="0" cellSpacing="0" width="100%">
<tr> <span lang="zh-cn">
<td width="88%" height="18"><p align="right">
<%
end sub
if i=1 then
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
'response.write " 页次: "
' response.write " 共<b>"&totalnumber&"</b>个flash <b>"&maxperpage&"</b>个flash/页 "
'response.write " 转到:<input type='text' name='page' size=4 maxlength=10 class=smallInput value="¤tpage&">"
' response.write "<input class=buttonface type='submit' value=' 确定 ' name='cndok'></span></p></form>"
end function
function showpage1(totalnumber,maxperpage,filename)
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
Response.Write "本类电影共有:<font face=""arial"" color=""red"">"&totalnumber&"</font>部 <font face=""arial"" color=""red"">"&CurrentPage&"/</font><font face=""arial"" color=""red"">"&n&"</font>页 "
if CurrentPage<2 then
response.write "<font color='999966'>首页 上一页</font> "
else
response.write "<a href="&filename&"?id="&id&"&page=1>首页</a> "
response.write "<a href="&filename&"?id="&id&"&page="&CurrentPage-1&"&ph="&ph&">上一页</a> "
end if
if n-currentpage<1 then
response.write "<font color='999966'>下一页 尾页</font>"
else
response.write "<a href="&filename&"?id="&id&"&page="&(CurrentPage+1)
response.write "&ph="&ph&">下一页</a> <a href="&filename&"?id="&id&"&page="&n&">尾页</a>"
end if
response.write " </td>"
response.write "<form name=""Listbox1"">"
response.write "<td width=""35"" height=""18"">"
dim n
%>
<select name="Menu_HuLiguo2" size="1" c="<%=i%>" onchange="Listbox1_HuLiguo1(document.Listbox1.Menu_HuLiguo2.options[document.Listbox1.Menu_HuLiguo2.selectedIndex].value)">
<option selected>请选择</option>
<%for j=1 to n%>
<option value="sort.asp?id=<%=id%>&page=<%=j%>&ph=<%=ph%>" > 第<%=j%>页</option>
<%next%>
</select>
<%
end function
sub gotopage
end sub
end if
结果如图 把所有的分页代码也重复输出了,而且一直都ii=0。