标题:求教:留言版问题
取消只看楼主
Flyx
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-4-29
 问题点数:0 回复次数:3 
求教:留言版问题
我想将现有的留言版按回复时间排序, 就像论坛里的一样, 最后回复的内容在最上面

以前是按数据库里的id进行排序的  我把排序改成了按回复时间,

可页面显示的却是按留言时间排出来的 而且最新回复的留言还是在那个位置.

有没有高手可以帮我一下? 谢谢了
搜索更多相关主题的帖子: 留言 
2005-04-29 15:34
Flyx
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-4-29
得分:0 

代码挺长的, 希望你不要看晕了, 先谢谢楼上的了 <!--#include file="conn.asp"--><HTML><HEAD><TITLE>留言板</TITLE> <META http-equiv=Content-Type content="text/html; charset=gb2312"> <LINK href="newsfanweb.css" type=text/css rel=stylesheet> <SCRIPT language=JavaScript type=text/JavaScript> <!-- function MM_goToURL() { //v3.0 var i, args=MM_goToURL.arguments; document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'"); } //--> </SCRIPT> <% //页数 page=clng(request("page")) book=request("book")

%> <% sql="select * from xxfk order by id desc" //搜索内容 search=request("search") if len(search)>0 then search=replace(search,chr(39),"'") sql="select * from xxfk where name like '%"&search&"%'or title like '%"&search&"%' or info like '%"&search&"%'or company like '%"&search&"%' order by id desc" 'response.write sql 'response.end end if

set rs=server.createobject("adodb.recordset")

rs.open sql,conn,3,3

//是否有留言内容 if rs.bof and rs.eof then if len(search)=0 then response.redirect("add_say.asp") else response.redirect "search_no.asp?search="&search end if end if 'response.write sql1 'response.end if pagerow>0 then rs.pagesize=pagerow else rs.pagesize=10 end if

if page < 1 then page=1 if page > rs.pagecount then page=rs.pagecount overallcount=rs.recordcount overallpage=rs.pagecount

'showsay rs,page %> <% rs.absolutepage=page %> <META content="Microsoft FrontPage 5.0" name=GENERATOR></HEAD> <BODY bgcolor="#FFFFFF"> <center> <table cellSpacing=0 cellPadding=0 width=760 align=center border=0> <tr> <td width=760 height=30> <!--#include file="top.htm"--> </td> </tr> </center>

<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0> <TBODY> <TR> <TD> <TABLE cellSpacing=0 cellPadding=0 width=721 align=center border=0> <TBODY> <TR> <TD width="721"> <p align="center"> <IMG src="images/lyb.gif" width="200" height="56"></TD></TR></TBODY></TABLE> <TABLE cellSpacing=1 cellPadding=5 width=726 align=center bgColor=#666666 border=0> <TBODY> <TR> <TD bgColor=#e7ffde width="714"> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD width="76%"><BUTTON class=CuButtons title=发表新帖子 onclick="MM_goToURL('parent','post.htm');return document.MM_returnValue" name=b100> <IMG src="images/pb_edit.gif" align=absMiddle border=0>&nbsp;发表新留言</BUTTON> </TD> <TD width="12%"> <DIV align=center> </DIV></TD> <TD width="12%"> <DIV align=center> </DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE> <TABLE cellSpacing=0 cellPadding=0 width=740> <TBODY> <TR> <TD height=5></TD></TR></TBODY></TABLE> <TABLE cellSpacing=1 cellPadding=3 width=730 align=center bgColor=#333333 border=0> <TBODY> <TR bgColor=#4160a0> <TD colSpan=6 width="722" bgcolor="#16A402"> </TD></TR> <TR bgcolor="#CDFEC0"> <TD width=40> <DIV align=center>回复</DIV></TD> <TD width=360 > <DIV align=center>文章列表,点击标题打开</DIV></TD> <TD width=90> <DIV align=center>留言人</DIV></TD> <TD width="83"> <DIV align=center>发表时间</DIV></TD> <TD width="76"> <DIV align=center>回复日期</DIV></TD> <TD width="45"> <p align="center">点击</TD></TR> <% for i=1 to rs.pagesize %> <TR onmouseover="this.bgColor='#E8F4FF'" onmouseout="this.bgColor='#FFFFFF'" bgColor=#ffffff> <TD width="40"> <DIV align=center><%set rs1=server.createobject("adodb.recordset") sql1="select * from reply where infoid='" & rs("id") & "' order by id" rs1.open sql1,conn,1,1 if rs1.recordcount>0 then response.write "<font color=red><b>" & "+" & "</b></font>" else response.write "<font color=red><b>" & "-" & "</b></font>" end if rs1.close %></DIV></TD> <TD width="360"><a href="#"><font style="cursor:hand" onclick="window.open('xxll.asp?id=<%=rs("id")%>', '')" title="单击看详细信息"><%=rs("title")%></font></a></TD> <TD width="90"> <DIV align=center><%=rs("name")%></DIV></TD> <TD width="83"> <DIV align=center><%=rs("addtime")%></DIV></TD> <TD width="76"> <DIV align=center><%set rs1=server.createobject("adodb.recordset") sql1="select * from reply where infoid='" & rs("id") & "' order by id" rs1.open sql1,conn,1,1 if rs1.recordcount>0 then rs1.movelast %> <%=rs1("retime")%><% end if rs1.close%> </DIV></TD> <TD width="45">  <%=rs("hit")%></TD></TR> <% rs.movenext if rs.eof then exit for end if next rs.close set conn=nothing %> <TR bgcolor="#CDFEC0"> <TD width="40"> <DIV align=center>回复</DIV></TD> <TD width="360"> <DIV align=center>文章列表,点击标题打开</DIV></TD> <TD width="90"> <DIV align=center>留言人</DIV></TD> <TD width="83"> <DIV align=center>发表时间</DIV></TD> <TD width="76"> <DIV align=center>回复日期</DIV></TD> <TD width="45"> <p align="center">点击</TD></TR></TBODY></TABLE> <TABLE cellSpacing=0 cellPadding=3 width=728 align=center border=0 height="11"> <TBODY> <TR> <TD width="722" height="5"></TD></TR></TBODY></TABLE> <DIV align=center style="width: 760; height: 56"> <table width="672" border="0" cellspacing="0" cellpadding="2" align="center" > <tr> <td align="center" width="668"> <form name="form2" method="post" action="xxfk.asp?book=true"> <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="70C570" height="19" style="border-collapse: collapse" bordercolor="#b5c7e7"> <tr> <td height="24"> <table width="107%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CDFEC0" class="text9" style="border-collapse: collapse" bordercolor="#111111"> <tr> <td width="38%" align="center" height="36">关键字: <input type="text" name="search" class="text" size="15" maxlength="20"> <input type="submit" name="Submit3" value="搜 索" class="text9"> </td> <td width="29%" align="center" height="36">共<font color="#FF0000"><%=overallpage%></font>页/<font color="#FF0000"><%=overallcount%></font>条留言&nbsp;&nbsp;转第 <input type="text" name="page" class="text" size="3" maxlength="4" value="<%=page%>"> 页</td> <td align="center" width="13%" height="36"> <%if page=1 then %> <img src="images/up0.gif" width="80" height="13" border="0" alt="已 是 第 一 页"> <%else %> <a href="xxfk.asp?page=<%=page-1%>&book=true"> <img src="images/up.gif" width="80" height="13" border="0" alt="向 上 一 页"></a> <%end if%> </td> <td align="center" width="27" height="36"> <%if page=overallpage then %> <a> <img src="images/down0.gif" width="80" height="13" border="0" alt="已 是 最 下 一 页"></a> <%else%> <a href="xxfk.asp?page=<%=page+1%>&book=true"> <img src="images/down.gif" width="80" height="13" border="0" alt="向 下 一 页"></a> <%end if%> </td> </tr> </table> </td> </tr> </table> </form> </td> </tr> </table>   </DIV></TD></TR></TBODY></TABLE> <center> <table cellSpacing=0 cellPadding=0 width=778 align=center border=0> <tr> <td width=760 height=30 bgcolor="#5F8CE9"> <!--#include file="buttom.htm"--> </td> </tr> </center>

</BODY></HTML>

[此贴子已经被作者于2005-4-29 15:56:58编辑过]

2005-04-29 15:55
Flyx
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-4-29
得分:0 
我只是将红色标记的那里给改了一下,  是不是还要对其它地方进行修改?
2005-04-29 16:00
Flyx
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-4-29
得分:0 
我把它改过了, 可是页显示的不知道是按什么排序了,一点规律也找不着
2005-04-29 16:59



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-17036-1-1.html




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

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