高手帮忙! 查询页面不能实现分页功能! 当点击下一页时候 变出现:没有检索到任何产品,请返回.及是不能实现分页.代码如下:
1 查询页面代码:
<table border="0" cellpadding="0" cellspacing="0">
<form name="myform" action="sp_recarchresult.asp" method="post">
<%dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from pp order by pp_id ",conn,1,1%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("pp_name"))%>","<%= rs("pp_lbid")%>","<%= rs("pp_belongsortid")%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.sj.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][2] == locationid)
{
document.myform.sj.options[document.myform.sj.length] = new Option(subcat[i][0], subcat[i][1]);
}
}
}
//-->
</script>
<tr>
<td width="118" valign="middle" nowrap="nowrap"><img src="image/woyaozhao.gif" width="117" height="39" /></td>
<td width="571" valign="middle" nowrap="nowrap"> 类别:
<%
rs.open "select * from sort order by order_id",conn,1,1
if rs.eof and rs.bof then
response.write "请先选择类别。"
response.end
else
%>
<select name="dl" size="1" id="dl" onChange="changelocation(document.myform.dl.options[document.myform.dl.selectedIndex].value)">
<option selected value="<%=rs("order_lbid")%>"><%=trim(rs("order_name"))%></option>
<%
dim selclass
selclass=rs("order_lbid")
rs.movenext
do while not rs.eof
%>
<option value="<%=rs("order_lbid")%>"><%=trim(rs("order_name"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
商家:
<select name="sj" id="sj">
<%rs.open "select * from pp where pp_belongsortid="&selclass ,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option selected value="<%=rs("pp_lbid")%>"><%=rs("pp_name")%></option>
<% rs.movenext
do while not rs.eof
%>
<option value="<%=rs("pp_lbid")%>"><%=rs("pp_name")%></option>
<% rs.movenext
loop
end if
rs.close
set rs=nothing
%>
</select>
关键字:
<label>
<input name="keyword" type="text" size="20" maxlength="40" />
</label></td>
<td width="97" valign="middle" nowrap="nowrap"><input type="image" src="image/ss.gif" alt="搜索"/></td>
<td width="31" valign="middle"><img src="image/wh.gif" width="22" height="25" /></td>
<td width="52" valign="middle" nowrap="nowrap">如何搜索</td>
</tr>
</form>
</table>
2 处理查询页面代码
<% lb=trim(cint(request("dl")))
sj=trim(cint(request("sj")))
keyword=trim(request("keyword"))
if request("keyword")="" then
sql="select * from product where product_lbid='"&lb&"' and product_belongppid='"&sj&"' order by product_id"
else
sql="select * from product where product_lbid='"&lb&"' and product_belongppid='"&sj&"' and product_name like '%"&keyword&"%' order by product_id"
end if
%>
<table width="917" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="3" height="33" background="image/tg_pp.jpg"> </td>
</tr>
<tr>
<td width="7" background="image/tg_lb_b0.jpg"> </td>
<td width="899">
<table width="250" height="47" border="1" align="center" cellpadding="9" cellspacing="9" bordercolor="#ffffff" >
<tr >
<%
set rs1=conn.execute("select * from pp where pp_belongsortid='"&lb&"' order by pp_id")
do while not rs1.eof
i=i+1
%>
<td align="center" bordercolor="#CCCCCC"><img src="<%=rs1("pp_imgurl")%>" width="148" height="40" alt="<%=rs1("pp_name")%>"/></td>
<%if i mod 5=0 then%>
</tr>
<% end if
rs1.movenext
loop
rs1.close()
set rs1=nothing
%>
</table>
</td>
<td background="image/tg_lb_b11.jpg" width="8"> </td>
</tr>
<tr>
<td colspan="3"height="23"background="image/tg_b.jpg" > </td>
</tr>
</table>
<table width="917" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="33"background="image/wdcp.jpg"> </td>
</tr>
<tr>
<td background="image/wdcp_xx.jpg" height="29"> </td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
if rs.eof then
%>
<tr><td align="center" >没有检索到任何产品,请<a href="javascript:history.go(-1)">返回</a></td></tr>
<%else
rowcount=2
rs.pagesize=rowcount
counts=rs.recordcount
totalpage=rs.pagecount
currpage=request.form("page")
if not isnumeric(currpage) then error("<li>错误的Page参数;")
currpage=cINT(currpage)
if currpage<1 then
currpage=1
elseif currpage>totalpage then
currpage=totalpage
end if
rs.absolutepage=currpage
do while not rs.eof and rowcount>0
%>
<tr>
<td height="29">
<table width="100%" border="0">
<tr>
<SCRIPT language=JavaScript type=text/javascript>
function openMenu<%=rs("product_id")%>(){
if (document.getElementById){
document.getElementById("menu<%=rs("product_id")%>").style.visibility='visible';
}
}
function closeMenu<%=rs("product_id")%>(){
if (document.getElementById){
document.getElementById("menu<%=rs("product_id")%>").style.visibility='hidden';
}
}
</SCRIPT>
<td width="14%" align="center" onmouseover=openMenu<%=rs("product_id")%>() onmouseout=closeMenu<%=rs("product_id")%>()>
<DIV id=Layer1<%=rs("product_id")%> style="Z-INDEX: 1; right: -50px; WIDTH: 0px; POSITION: relative; TOP: 5px; HEIGHT: 0px">
<DIV id=menu<%=rs("product_id")%> style="Z-INDEX: 2; LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px">
<table width="226" border="0" cellspacing="0" cellpadding="0" height="222">
<tr>
<td background="image/sp_xxb.jpg" width="226" height="222" align="center"><img src="<%=rs("product_url")%>" width="170" height="150" border="0" /></td>
</tr>
</table>
</DIV>
</DIV>
<a href="sp_list.asp?id=<%=rs("product_id")%>"><img src="<%=rs("product_url")%>" width="100" height="80" border="0" /></a></td>
<td width="30%" align="center"><%=rs("product_name")%></td>
<td width="12%" align="center"><%=rs("product_gg")%></td>
<td width="6%" align="center"><%=rs("product_order")%></td>
<td width="20%" align="center"><%=rs("product_place")%></td>
<td width="7%" align="center"><del><%=rs("product_price")%>.00</del></td>
<td width="11%"><font size="4" color="#F6881F"><%=rs("product_tprice")%>.00</font></td>
</tr>
<tr> <td colspan="7" background="image/sc_b.jpg" height="12"></td></tr>
</table>
</td>
</tr>
<%
rs.Movenext
rowcount=rowcount-1
loop
%>
<tr><td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<form action="sp_recarchresult.asp?sj=<%=rs("product_belongppid")%>&lb=<%=rs("product_lbid")%>&keyword=<%=keyword%>" method="post">
<tr bordercolor="#F6881F" height=30><td width="28%" bgcolor="#F6881F" align="center" colspan="7"> 共<%=totalpage+0%>页 当前第<%=currpage+0%>页 共检索到<%=counts+0%>条</td><td width="72%" align=center bgcolor="#F6881F"><%if currpage<=1 then%>〖首页〗〖上一页〗<%else%>〖<a href='?page=1&sj=<%=rs("product_belongppid")%>&lb=<%=rs("product_lbid")%>&keyword=<%=keyword%>'>首页</a>〗〖<a href='?page=<%=currpage-1%>&sj=<%=rs("product_belongppid")%>&lb=<%=rs("product_lbid")%>&keyword=<%=keyword%>'>上一页</a>〗<%end if%><%if (totalpage-currpage)<=0 then%>〖下一页〗〖尾页〗<%else%>〖<a href='?page=<%=currpage+1%>&sj=<%=rs("product_belongppid")%>&lb=<%=rs("product_lbid")%>&keyword=<%=keyword%>'>下一页</a>〗〖<a href='?page=<%=totalpage%>&sj=<%=rs("product_belongppid")%>&lb=<%=rs("product_lbid")%>&keyword=<%=keyword%>'>尾页</a>〗<%end if%> 转到<input name=page size=1 value="<%=currpage+0%>">页<input type=submit value="GO">
</td></tr></form></table></td></tr>
<%
rs.close
set rs=nothing
end if
%>
请问是哪里出问题了 请帮忙! 小第在这里先谢过了!