01-07-2005, 18:30
|
|
מנהל פורום פלאש
|
|
חבר מתאריך: 04.03.05
הודעות: 5,834
|
|
טבלת תוצאות
הורדתי ספר אורחים מהאינטרנט ב
ASP
וערכתי אותו עד שיתאים להיות טבלת נקודות
High Scores
איך אני עושה שמי שיש לו ניקוד יותר גבוהה מקבל מספר יותר טוב, הכוונה אם זה יותר גבוה מהשני אז זה יהיה מקום ראשון, ושהמקומות הראשונים יהיו יותר למעלה בדף?
הנה הקוד:
קוד:
<%@ Language="VBScript" %>
<% Option Explicit %>
<%Dim RecordsPerPage,currentpage,u,pages,rs1,rs2
currentpage = Request.QueryString("currentpage")
IF currentpage ="" OR currentpage < 1 Then
currentpage = 1
END IF
RecordsPerPage = 50
%>
<!--#include file="inc_head.asp"-->
<!--#include file="dbconn.asp"-->
<%
Dim sql,rsShowGB,total
sql = "SELECT * FROM mess ORDER BY datetime DESC"
Set rsShowGB = Server.CreateObject("ADODB.Recordset")
rsShowGB.Open sql, dbconn, 3, 3
total = rsShowGB.RecordCount
%>
<%
rsShowGB.PageSize = RecordsPerPage
If NOT rsShowGB.EOF Then rsShowGB.AbsolutePage = currentpage
If rsShowGB.EOF Then
%>
<center>
<table width="300" cellspacing="0" bgcolor="#cccccc" Align="center" border>
<tr>
<td>
<center><font size="3" class="font"><b>No entries found in High Scores</b></font></center>
</td>
</tr>
</table>
<%Else
For u=1 to RecordsPerPage
IF rsShowGB.EOF Then Exit For%>
<table width="700" cellspacing="0" bgcolor="#cccccc" Align="center" border="0">
<tr>
</tr>
<tr>
<td width="30%">
<table width="30%" cellspacing="0" border="0">
<tr>
<td bgcolor="#999999">
<font size="2" class="font"><!-- name --> <%=rsShowGB("postedby")%> </font>
</td>
<td bgcolor="#666666">
<font size="2" class="font"> <!-- score --> <%=rsShowGB("score")%> </font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
<% rsShowGB.movenext
Next%>
<%
pages = int(total/RecordsPerPage)
IF (total MOD RecordsPerPage) <> "0" Then
pages = pages + 1
END IF
rs2 = int(currentpage*RecordsPerPage)
rs1 = int(rs2-RecordsPerPage+1)
%>
<br>
<table width="700" cellspacing="0" height="10" Align="center">
<tr>
<td bgcolor="#DDDDDD" width="20%">
<font size="2"><%IF currentpage = "1" Then%>PREVIOUS<%ELSE%><a href="?currentpage=<%=currentpage-1%>">PREVIOUS</a><%END IF%> </font>
</td>
<td bgcolor="#DDDDDD" width="30%">
<font size="2">Showing High Scores <%=rs1%> To <%IF int(currentpage) = int(pages) Then%><%=total%><%ELSE%><%=rs2%> <%END IF%> Of <%=total%></font>
</td>
<td bgcolor="#DDDDDD" Align="right" width="30%">
<font size="2">Page <%=currentpage%> Of <%=pages%> </font>
</td>
<td bgcolor="#DDDDDD" Align="right" width="20%">
<font size="2"><%IF int(currentpage) < int(pages) Then%><a href="?currentpage=<%=currentpage+1%>">NEXT</a><%ELSE%>NEXT<%END IF%> </font>
</td>
</tr>
</table>
<%END IF%>
<!--#include file="inc_footer.asp"-->
והנה הקישור לדף שלי...:
|