| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 387 人关注过本帖
标题:有关搜索出来分页问题,麻烦一下大家
只看楼主 加入收藏
taoxinhui
Rank: 1
等 级:新手上路
帖 子:71
专家分:0
注 册:2007-8-7
收藏
 问题点数:0 回复次数:4 
有关搜索出来分页问题,麻烦一下大家

<%t_name = TRIM(request("t_name"))
class_search_id = TRIM(request("class_search_id"))
rpagesize = 40
DIM rpage,rROWCOUNT
SET RS_maga=SERVER.CREATEOBJECT("ADODB.Recordset")
RS_maga.MAXRECORDS=maxrecords
RS_maga.PageSize=rpagesize
if t_name <> "" then
if class_search_id="-1" then
searchSql = "select * from lw_mag where mag_name like '%"&t_name&"%' order by mag_id desc"
else
searchSql="select * from lw_mag where mag_issn like '%"&t_name&"%' or mag_cn like '%"&t_name&"%' order by mag_id desc"
end if
else
searchSql = "select * from lw_mag order by mag_id desc"
end if
if class_search_id_int > -1 then
searchStr_comm = "&class_search_id=" & class_search_id
else
searchStr_comm = ""
if t_name <> "" then searchStr_comm = searchStr_comm & "&t_name=" & server.URLEncode(t_name)
searchStr = searchStr_comm
end if %>
。。。。。。。。。。。。。。。。。。。。。(html)显示部分就省了
<% RS_maga.OPEN searchSql,conn,1,1
if not RS_maga.eof then
IF TRIM(REQUEST("rpage"))="" THEN
rpage = 1
else
rpage=cint(TRIM(REQUEST("rpage")))
end if
RS_maga.ABSOLUTEPAGE = rpage
end if
%>
<%
rROWCOUNT = 0
WHILE NOT RS_maga.EOF AND rROWCOUNT < RS_maga.PageSize
response.write "<tr>"
response.write "<td width=""13"" height=""25"">"
response.write "&nbsp;</td>"
response.write "<td width=""120"" height=""25"" >"
response.write RS_maga("mag_special")
response.write "</td>"
response.write "<td width=""200"" height=""25"" >"
if has_login or true then

response.write "<a href=""magdomestic.html/m_id/"&rs_maga("mag_id")&" "" target=""_blank"">"
response.write rs_maga("mag_name")
response.write "</a>"
else
response.write rs_maga("mag_name")
end if


response.write "</td>"
response.write "<td width=""70"" height=""25"" >"

response.write RS_maga("mag_level")
response.write "</td>"
response.write "<td width=""120"" height=""25"" >"

response.write RS_maga("mag_d_unit")
response.write "</td>"
RS_maga.MOVENEXT
rROWCOUNT = rROWCOUNT+1

WEND
if rROWCOUNT = 0 then
response.write "<tr>"
response.write "<td colspan=""3"" align=""center"">"
response.write "<br><br>很抱歉,您查找的没有。<br>"
response.write "</td>"
response.write "</tr>"
end if

%>
<tr>
<td>&nbsp;</td>
<td colspan="4" align="right"><form name="form1" method="post" action="magazlinelib.html?a=1<%=searchStr%>#magas" onSubmit="return chk_form_msg(this)">
<%
if rROWCOUNT > 0 then

response.write "总供搜索到&nbsp;<font color=""#FF9900"">" & RS_maga.recordcount & "</font>"
response.write "&nbsp;个资料 共&nbsp;<font color=""#FF9900"">" & RS_maga.PAGECOUNT & "</font>&nbsp;页 第&nbsp;<font color=""#FF9900"">"
response.write rpage & "</font>&nbsp;页 "

IF rpage > 1 THEN
response.write "<a href=""/magazlinelib_search.html?rpage="
response.write "1" & searchStr & "#magas"
response.write """>"
response.write "<img src=""/images/first.gif"" alt=""第一页"" border=""0"">"
response.write "</a>"
response.write "<a href=""/magazlinelib_search.html?rpage="
response.write cstr(rpage-1) & searchStr & "#magas"
response.write """>"
response.write "<img src=""/images/previous.gif"" alt=""上一页"" border=""0"">"
response.write "</a>"
else
response.write "<img src=""/images/first.gif"" alt=""第一页"" border=""0"">"
response.write "<img src=""/images/previous.gif"" alt=""上一页"" border=""0"">"
end if
response.write "&nbsp;"
IF rpage < rs_maga.PAGECOUNT THEN
response.write "<a href=""/magazlinelib_search.html?rpage="
response.write cstr(rpage+1) & searchStr & "#magas"
response.write """>"
response.write "<img src=""/images/next.gif"" alt=""下一页"" border=""0"">"
response.write "</a>"
response.write "<a href=""/magazlinelib_search.html?rpage="
response.write rs_maga.PAGECOUNT & searchStr & "#magas"
response.write """>"
response.write "<img src=""/images/last.gif"" alt=""最后一页"" border=""0"">"
response.write "</a>"
else
response.write "<img src=""/images/next.gif"" alt=""下一页"" border=""0"">"
response.write "<img src=""/images/last.gif"" alt=""最后一页"" border=""0"">"
end if

response.write "<input type=""text"" name=""rpage"" size=""3"">"
response.write "<input type=""image"" src=""/images/submit.gif"" width=""22"" height=""23"" alt=""跳转至"">"


end if

%>
</form>
问题就是搜索结果到是搜索出来了,但在我点下一页的时候,不是搜索出来的数据,是数据库全部的数据。比方说,我搜的工字,结果出来了139个资料,15个页面,点下一页的时候,就是搜索5900个资料,这是全部数据库的信息。。麻烦看看

搜索更多相关主题的帖子: 搜索 麻烦 
2007-11-16 15:58
YSKING
Rank: 5Rank: 5
来 自:中国绿城
等 级:贵宾
威 望:16
帖 子:1380
专家分:25
注 册:2006-11-11
收藏
得分:0 
按下一页面的时候把查询的内容再重新查询一遍,再显示出当前页的内容

仍然自由自我,永远高唱我歌,走遍千里...
2007-11-16 16:40
taoxinhui
Rank: 1
等 级:新手上路
帖 子:71
专家分:0
注 册:2007-8-7
收藏
得分:0 
怎么修改啊。说的详细点
2007-11-16 16:49
YSKING
Rank: 5Rank: 5
来 自:中国绿城
等 级:贵宾
威 望:16
帖 子:1380
专家分:25
注 册:2006-11-11
收藏
得分:0 

仍然自由自我,永远高唱我歌,走遍千里...
2007-11-16 16:52
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
searchStr_comm = "&class_search_id=" & class_search_id
上在的搜索条件是searchStr_comm,为什么到下面变成searchStr了?
response.write "1" & searchStr & "#magas"
searchStr = searchStr_comm
虽然这里有赋值,但是只针对了一个条件。
2007-11-16 16:56
快速回复:有关搜索出来分页问题,麻烦一下大家
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029810 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved