<div class="weekly_content_list">
<%'开始分页
Const MaxPerPage=2
dim totalPut
dim CurrentPage
dim TotalPages
dim j
if Not isempty(request("page")) then
currentPage=Cint(request("page"))
else
currentPage=1
end if
Set Rs = Db.CreateRS()
sql="select * from weekly"
sql="select * from weeklySort where ID>0"
namekey=FLib.SafeSql(Request("namekey"))
if namekey<>"" then
sql=sql&" and SortName like '%"&namekey&"%'"
end if
if SortID<>"" then
sql=sql&" and SortID="&SortID&""
end if
sql=sql&" order by PX desc"
Rs.Open Sql, Db.Conn, 1, 1
if err.number<>0 then
response.write "数据库中无数据"
end if
if rs.eof And rs.bof then
Response.Write "<p align='center' class='contents'> 没有此类信息!<a href='#' onclick='history.go(-1);'>返回上一步</a></p>"
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,"weekly.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim book
book=rs.book
showContent
showpage totalput,MaxPerPage,"weekly.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"weekly.asp"
end if
end if
end if sub showContent
dim i
i=0
%>
<div>
<%
cols=3
do while not rs.eof
if abc mod cols=0 then response.Write("<tr>")
abc=abc+1
%>
<div class="weekly_content_list_table">
<div class="weekly_content_list_time">
<img src="../<%=rs("SmallPic")%>" />
</div>
<div class="weekly_content_list_name" style="background-color:#999; text-align:center; font-size:17px;"><%=rs("SortName")%></div>
<div class="weekly_content_list_name">
<li><a href="#">小标题2</a></li>
<li><a href="#">小标题2</a></li>
<li><a href="#">小标题2</a></li>
<li><a href="#">小标题2</a></li>
</div>
</div><%
i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing%>
</div>
</div>
<%'开始分页
Const MaxPerPage=2
dim totalPut
dim CurrentPage
dim TotalPages
dim j
if Not isempty(request("page")) then
currentPage=Cint(request("page"))
else
currentPage=1
end if
Set Rs = Db.CreateRS()
sql="select * from weekly"
sql="select * from weeklySort where ID>0"
namekey=FLib.SafeSql(Request("namekey"))
if namekey<>"" then
sql=sql&" and SortName like '%"&namekey&"%'"
end if
if SortID<>"" then
sql=sql&" and SortID="&SortID&""
end if
sql=sql&" order by PX desc"
Rs.Open Sql, Db.Conn, 1, 1
if err.number<>0 then
response.write "数据库中无数据"
end if
if rs.eof And rs.bof then
Response.Write "<p align='center' class='contents'> 没有此类信息!<a href='#' onclick='history.go(-1);'>返回上一步</a></p>"
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,"weekly.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim book
book=rs.book
showContent
showpage totalput,MaxPerPage,"weekly.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"weekly.asp"
end if
end if
end if sub showContent
dim i
i=0
%>
<div>
<%
cols=3
do while not rs.eof
if abc mod cols=0 then response.Write("<tr>")
abc=abc+1
%>
<div class="weekly_content_list_table">
<div class="weekly_content_list_time">
<img src="../<%=rs("SmallPic")%>" />
</div>
<div class="weekly_content_list_name" style="background-color:#999; text-align:center; font-size:17px;"><%=rs("SortName")%></div>
<div class="weekly_content_list_name">
<li><a href="#">小标题2</a></li>
<li><a href="#">小标题2</a></li>
<li><a href="#">小标题2</a></li>
<li><a href="#">小标题2</a></li>
</div>
</div><%
i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing%>
</div>
</div>
想在li列表显示weekly表里面的sortid等于weeklysort里的id 的内容:<div class="weekly_content_list_name">
<li><a href="#">小标题2</a></li>
<li><a href="#">小标题2</a></li>
<li><a href="#">小标题2</a></li>
<li><a href="#">小标题2</a></li>
</div>这里再做个查询和循环显示就行了啊貌似很容易
Set Rs = Db.CreateRS()
Sql = "Select top 11 ID,ProductName,SortID,AddTime from weekly where SortID=SortID"
Rs.Open Sql, Db.Conn, 1, 1
if Not Rs.eof then
do while not rs.eof%>
<li><a href="viewweek.asp?weeklyID=<%=Rs("ID")%>&SortID=<%=rs("SortID")%>" target="_blank"><span><%=left(Rs("ProductName"),8)%></span></a></li>
<%
rs.movenext
loop
end if
rs.close
set rs=nothing
%>
直接替换过去就是了
你是想做一个二级查询,SQL 中的条件要用到第一个RS中的SortID
SortID=rs["SortID"]
<%
Set Rs = Db.CreateRS()
Sql = "Select top 11 ProductName,SortID,AddTime from weekly where SortID=<%=rs("SortID")%>"
Rs.Open Sql, Db.Conn, 1, 1
if Not Rs.eof then
do while not rs.eof%>
<li><a href="viewweek.asp?weeklyID=<%=Rs("ID")%>&SortID=<%=rs("SortID")%>" target="_blank"><span><%=left(Rs("ProductName"),8)%></span></a></li>
<%
rs.movenext
loop
end if
rs.close
set rs=nothing
%>
Set Rs = Db.CreateRS()
Sql = "Select top 11 ProductName,SortID,AddTime from weekly where SortID=<%=rs("SortID")%>"
Rs.Open Sql, Db.Conn, 1, 1
if Not Rs.eof then这个SQL明显有问题,楼上都告诉你怎么改了,咋还没找到呢? Sql = "Select top 11 ProductName,SortID,AddTime from weekly where SortID=" & rs("SortID")