| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1302 人关注过本帖
标题:网站判断问题
只看楼主 加入收藏
sydpoechang
Rank: 1
等 级:新手上路
帖 子:115
专家分:0
注 册:2007-8-22
收藏
 问题点数:0 回复次数:10 
网站判断问题
现在有十个数据进行排行
1、2名前面显示1、2名的图片
3、4名前面显示3、4名的图片以此类退
求这样的代码
谢谢了
搜索更多相关主题的帖子: 判断 数据 代码 排行 
2008-01-29 12:42
flynet
Rank: 3Rank: 3
来 自:北京
等 级:论坛游民
威 望:7
帖 子:352
专家分:60
注 册:2007-1-28
收藏
得分:0 
按什么条件排了?

PHP 新人 不断学习进取中。。。
2008-01-29 13:19
sydpoechang
Rank: 1
等 级:新手上路
帖 子:115
专家分:0
注 册:2007-8-22
收藏
得分:0 
按照发帖数
2008-01-29 13:43
flynet
Rank: 3Rank: 3
来 自:北京
等 级:论坛游民
威 望:7
帖 子:352
专家分:60
注 册:2007-1-28
收藏
得分:0 
总有个字段记录他们的发帖数吧? 按照发帖数 desc 排序 就好了啊?循环显示例子:user 表  counts 字段记录发帖数
其他省略
 sql=“select * from user order by counts desc”
rs.open sql,conn,1,1
i=1
do while not rs.eof
if i=1 or i=2 then
response.write("<img src='第1\2的图片'/>"&rs("username")&"<br>")
elseif i=3 or i=4 then
response.write("<img src='第3\4的图片'/>"&rs("username")&"<br>")
elseif i=5 or i=6 then
response.write("<img src='第5\6的图片'/>"&rs("username")&"<br>")
i=i+1
end if
rs.movenext
loop

PHP 新人 不断学习进取中。。。
2008-01-29 14:13
sydpoechang
Rank: 1
等 级:新手上路
帖 子:115
专家分:0
注 册:2007-8-22
收藏
得分:0 
<%
              Set rs=Server.CreateObject("ADODB.RecordSet")
              sql="select top 10 * from news order by hits desc"
              rs.open sql,conn,1,1
              i=0
              do while (not rs.eof) and (i < 10)
              if i=1 then
                response.write("<img src='icon/1.gif'/>"&rs("title")&"<br>")
                elseif i=2 then
                response.write("<img src='icon/2.gif'/>"&rs("title")&"<br>")
                elseif i=3 then
                 response.write("<img src='icon/3.gif'/>"&rs("title")&"<br>")
                 elseif i=4 then
                 response.write("<img src='icon/4.gif'/>"&rs("title")&"<br>")
                 elseif i=5 then
                 response.write("<img src='icon/5.gif'/>"&rs("title")&"<br>")
                  elseif i=6 then
                 response.write("<img src='icon/6.gif'/>"&rs("title")&"<br>")
                   elseif i=7 then
                 response.write("<img src='icon/7.gif'/>"&rs("title")&"<br>")
                   elseif i=8 then
                 response.write("<img src='icon/8.gif'/>"&rs("title")&"<br>")
                 elseif i=9 then
                 response.write("<img src='icon/9.gif'/>"&rs("title")&"<br>")
                  elseif i=10 then
                 response.write("<img src='icon/10.gif'/>"&rs("title")&"<br>")
              i=i+1
              rs.movenext
              end if
              loop
              %>

写成这样了 好象是个死循环
2008-01-29 14:46
flynet
Rank: 3Rank: 3
来 自:北京
等 级:论坛游民
威 望:7
帖 子:352
专家分:60
注 册:2007-1-28
收藏
得分:0 
do while (not rs.eof) and (i < 10)
这个 不需要 再加 and (i<10)了吧? 已经规定了 是记录尾了 所以不会是死循环 i是根据 记录数进行自加过程 程序已经规定了top 10 了 不是死的

PHP 新人 不断学习进取中。。。
2008-01-29 16:30
flynet
Rank: 3Rank: 3
来 自:北京
等 级:论坛游民
威 望:7
帖 子:352
专家分:60
注 册:2007-1-28
收藏
得分:0 
i=0
不对 i=1

PHP 新人 不断学习进取中。。。
2008-01-29 16:31
sydpoechang
Rank: 1
等 级:新手上路
帖 子:115
专家分:0
注 册:2007-8-22
收藏
得分:0 
万一遇到10和11的hits数相同的话 就会被全部提取出来
2008-01-29 16:41
sydpoechang
Rank: 1
等 级:新手上路
帖 子:115
专家分:0
注 册:2007-8-22
收藏
得分:0 
改成i=1之后提示不允许操作~!
2008-01-29 16:44
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
do while (not rs.eof) and (i < 10)
              if i=1 then
                response.write("<img src='icon/1.gif'/>"&rs("title")&"<br>")
                elseif i=2 then
                response.write("<img src='icon/2.gif'/>"&rs("title")&"<br>")
                elseif i=3 then
                 response.write("<img src='icon/3.gif'/>"&rs("title")&"<br>")
                 elseif i=4 then
                 response.write("<img src='icon/4.gif'/>"&rs("title")&"<br>")
                 elseif i=5 then
                 response.write("<img src='icon/5.gif'/>"&rs("title")&"<br>")
                  elseif i=6 then
                 response.write("<img src='icon/6.gif'/>"&rs("title")&"<br>")
                   elseif i=7 then
                 response.write("<img src='icon/7.gif'/>"&rs("title")&"<br>")
                   elseif i=8 then
                 response.write("<img src='icon/8.gif'/>"&rs("title")&"<br>")
                 elseif i=9 then
                 response.write("<img src='icon/9.gif'/>"&rs("title")&"<br>")
                  elseif i=10 then
                 response.write("<img src='icon/10.gif'/>"&rs("title")&"<br>")
              end if             '-----这个移到前面来
              i=i+1
              rs.movenext
              loop
试试这样
2008-01-30 02:11
快速回复:网站判断问题
数据加载中...
 
   



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

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