Link to "Survivor stats"

Message board links from 2010 as taken from the Internet Wayback Machine pages.
Post Reply
User avatar
admin
Site Admin
Posts: 159
Joined: Mon Aug 26, 2013 3:47 pm

Re: Link to "Survivor stats"

Post by admin »

09-05-2009 6:26 PM
mags
Top 50 Contributor
Joined on 09-06-2009
Posts 4

survivor stats
Reply Contact

Anyone know which part of the code to grab from the survivorStatistics.asp page (or simple way) to display the bottom part which is "Player Status Count" somewhere else?

Would like to display that on the main page once a user logs in...

thx
09-05-2009 10:30 PM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 456

Re: survivor stats
Reply Contact

In that survivorStatistics.asp file, there are a bunch of functions which you can copy over to the default.asp file:

'--------------------------------------------------------------------------
' Returns the number of players that were active in the given week.
'--------------------------------------------------------------------------
function GetActiveCount(week)

dim rs, sql

GetActiveCount = 0

sql = "SELECT COUNT(*) AS Total FROM SurvivorStatus" _
& " WHERE Week = " & week _
& " AND WasAlive"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
GetActiveCount = rs.Fields("Total").Value
end if

end function

'--------------------------------------------------------------------------
' Returns the number of players that used a buyback in the given week.
'--------------------------------------------------------------------------
function GetBuybackCount(week)

dim rs, sql

GetBuybackCount = 0

sql = "SELECT COUNT(*) AS Total FROM SidePicks" _
& " WHERE Week = " & week _
& " AND SurvivorBuyback"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
GetBuybackCount = rs.Fields("Total").Value
end if

end function

'--------------------------------------------------------------------------
' Returns the number of players eliminated in the given week.
'--------------------------------------------------------------------------
function GetEliminatedCount(week)

dim rs, sql

GetEliminatedCount = 0

sql = "SELECT COUNT(*) AS Total FROM SurvivorStatus" _
& " WHERE Week = " & week _
& " AND WasAlive AND NOT IsAlive AND NOT IsPending"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
GetEliminatedCount = rs.Fields("Total").Value
end if

end function

'--------------------------------------------------------------------------
' Returns the number of players that are pending in the given week.
'--------------------------------------------------------------------------
function GetPendingCount(week)

dim rs, sql

GetPendingCount = 0

sql = "SELECT COUNT(*) AS Total FROM SurvivorStatus" _
& " WHERE Week = " & week _
& " AND IsPending"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
GetPendingCount = rs.Fields("Total").Value
end if

end function

Then just call them with the current week:

dim currentWeek

currentWeek = GetCurrentWeek()

Response.Write("Active Survivor Players: " & GetActiveCount(currentWeek))

...
Filed under: customization

Page 1 of 1 (2 items)
Post Reply