| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 449 人关注过本帖
标题:[求助]留言显示错误
取消只看楼主 加入收藏
威龙嘉少
Rank: 1
等 级:新手上路
帖 子:205
专家分:0
注 册:2007-9-24
收藏
 问题点数:0 回复次数:1 
[求助]留言显示错误

我做留言显示的时候,输出的留言总数怎么是-1啊,而且只显示一个页面别的留言显示都没有了 ,还有一个问题就是在输出分页显示的下面又显示了一条留言,这是怎么回师啊,还没有遇到这样的问题的,有知道是怎么回师的吗?请帮帮忙啊,谢谢!
主要代码显示:
<%
dim totalput
dim currentpage
dim totalpages
dim a
if not isempty(request.QueryString("page")) then
currentpage=cint(request.QueryString("page"))
else
currentpage=1
end if

%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
body,td,th {
font-size: 18px;
color: #FF0000;
}
body {
background-image: url(image/m02.jpg);
background-repeat: repeat;
}
body {
background-attachment: fixed;
background-color: #CCCCCC;
background-image: url(image/m02.jpg);
background-repeat: repeat;
}
-->
</style>
</head>

<body>
<form id="form1" name="form1" method="post" action="liuyan1.asp">
<table width="387" height="214" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FF0000">
<tr>
<td width="143" height="36">&nbsp;用户名:</td>
<td width="168"><label>
<input type="text" name="name" />
</label></td>
</tr>
<tr>
<td height="31">&nbsp;密&nbsp; 码:</td>
<td><label>
<input type="password" name="pwd" />
</label></td>
</tr>
<tr>
<td height="67">&nbsp;留&nbsp; 言:</td>
<td><label>
<textarea name="ly" cols="20"></textarea>
</label></td>
</tr>
<tr>
<td bordercolor="#FF0000">&nbsp;性&nbsp; 别:</td>
<td><label>
<input type="radio" name="sex" value="男" />

</label>
<label>
<input type="radio" name="sex" value="女" />
女</label></td>
</tr>
<tr>
<td colspan="2" bordercolor="#FF0000"><label>
<input type="submit" name="Submit" value="提交" />
</label>
<label>
<input type="reset" name="Submit2" value="重置" />
</label></td>
</tr>
</table>
</form>
<%
set conn=server.createobject("adodb.connection")
DSNtemp = "Driver={Microsoft Access Driver (*.mdb)};"
DSNtemp = DSNtemp & "DBQ=" & server.mappath("xuesheng.mdb")
conn.open DSNtemp
set rs=conn.execute("select * from ly order by id desc")
if rs.eof and rs.bof then
response.Write("暂时还没有任何留言!")
else
totalput=rs.recordcount
response.Write(totalput)
listnum=6
rs.pagesize=listnum
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*listnum > totalput then
if (totalput mod listnum)=0 then
currentpage=totalput \ listnum
else
currentpage=totaaput \ listnum + 1
end if
end if
if currentpage=1 then
showContent
showpage totalput,listnum,"liuyan0.asp"
else
if (currentpage-1)* listnum < totalput then
rs.move (currentpage-1)*listnum
showContent
showpage totalput,listnum,"liuyan0.asp"
else
currentpage=1
showContent
showpage totalput,listnum,"liuyan0.asp"
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
%>
<%
sub showcontent
do while not rs.eof
response.Write("<hr / color='blue' width='60%'>")
response.Write("<table border='1' bordercolor='red' width='60%'>")
response.Write("<tr>")
response.Write("<td>编号:</td>"&"<td>"&rs("id")&"</td>")
response.Write("</tr>")
response.Write("<tr>")
response.Write("<td>姓名:</td>"&"<td>"&rs("name")&"</td>")
response.Write("</tr>")
response.Write("<tr>")
response.Write("<td>留言:</td>"&"<td>"&rs("ly")&"</td>")
response.Write("</tr>")
response.Write("<tr>")
response.Write("<td>性别:</td>"&"<td>"&rs("sex")&"</td>")
response.Write("</tr>")
a=a+1
if a>listnum then exit do
rs.movenext
response.Write("</table>")
loop
end sub
%>
<%
function showpage(totalnumber,listnum,filename)
dim n
if totalnumber mod listnum=0 then
n=totalnumber \ listnum
else
n=totalnumber \ listnum + 1
end if
response.write "<form method=post action="&filename&">"
response.write " "
if CurrentPage<2 then
response.write "<font color='#000080'>首页 上一页</font> "
else
response.write "<a href="&filename&"?page=1>首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&">上一页</a> "
end if
if n-currentpage<1 then
response.write "<font color='#000080'>下一页 尾页</font>"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&">下一页</a> "
response.write "<a href="&filename&"?page="&n&">尾页</a>"
end if
response.write "<font color='#000080'> 共<b>"&totalput&"</b>条留言 每页<b>"&listnum&"</b>条留言</font> "
response.write "<font color='#000080'>转到:</font><input class=smallInput type='text' name='page' size=4 maxlength=10 value="&Currentpage&">"
response.write "<input class=buttonface type='submit' value='Go' name='cndok'></form>"
end function
%>

搜索更多相关主题的帖子: 留言 
2007-10-05 15:56
威龙嘉少
Rank: 1
等 级:新手上路
帖 子:205
专家分:0
注 册:2007-9-24
收藏
得分:0 
为什么啊,以前这样用结果是一样的啊,这个问题解决了,可是在分页显示的下面总是出现一条留言记录是怎么回师啊,这条留言记录总是下一页的开头留言!
2007-10-06 07:23
快速回复:[求助]留言显示错误
数据加载中...
 
   



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

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