<% Function getTotal(str) SplittedString = Split(str, ",") total = 0 for i = 0 to UBound(SplittedString) -1 total = total + cint(SplittedString(i)) Next getTotal = total End Function SelectSQL = "select * from site_counter2 WHERE fldPage ='Default.asp' AND theyear = 2005" set rs=ADO.execute (SelectSQL) Dim monthArray(13) Dim dayArray(13,33) for i=1 to 12 monthArray(i) = 0 for j=1 to 32 dayArray(i,j) = 0 next Next do while NOT rs.eof themonth = rs("themonth") theday = rs("theday") totalcount = getTotal(rs("counterstring")) monthArray(themonth) = monthArray(themonth) + cint(totalcount) dayArray(themonth, theday) = dayArray(themonth,theday) + cint(totalcount) rs.movenext loop SelectSQL = "select * from site_counter2 WHERE fldPage ='Default.asp' AND theyear = 2005" set rs=ADO.execute (SelectSQL) Total = 0 for i=1 to 12 Total = Total + monthArray(i) Next '============================================== '======= including the HeaderTableStart '============================================== HeaderTableTitle = "Statistics: Show" %> <% HeaderTableEnd = "" ' must be added after including the HeaderTableStart '============================================== %>

<% for i=1 to 12 if monthArray(i) = 0 then %> <% else %> <% end if Next %> <% ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Calculat 2006 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' SelectSQL = "select * from site_counter2 WHERE fldPage ='Default.asp' AND theyear = 2006" set rs=ADO.execute (SelectSQL) 'Dim monthArray(13) 'Dim dayArray(13,33) for i=1 to 12 monthArray(i) = 0 for j=1 to 32 dayArray(i,j) = 0 next Next do while NOT rs.eof themonth = rs("themonth") theday = rs("theday") totalcount = getTotal(rs("counterstring")) monthArray(themonth) = monthArray(themonth) + cint(totalcount) dayArray(themonth, theday) = dayArray(themonth,theday) + cint(totalcount) rs.movenext loop SelectSQL = "select * from site_counter2 WHERE fldPage ='Default.asp' AND theyear = 2006" set rs=ADO.execute (SelectSQL) Total = 0 for i=1 to 12 Total = Total + monthArray(i) Next ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' End of: Calculat 2006 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' %> <% for i=1 to 12 if monthArray(i) = 0 then %> <% else %> <% end if Next %>
  Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Total
2005   <%=Total%>
2006    <%=Total%> 

<% SelectSQL = "select * from site_counter" set rs=ADO.execute (SelectSQL) do while NOT rs.eof page = rs("fldPage") Select case page case "Default.asp" Default_PageCounts = rs("fldCount") case "general.asp" general_PageCounts = rs("fldCount") case "research.asp" research_PageCounts = rs("fldCount") case "teaching.asp" teaching_PageCounts = rs("fldCount") case "currentSemester.asp" currentSemester_PageCounts = rs("fldCount") case "communityServices.asp" communityServices_PageCounts = rs("fldCount") End select rs.movenext loop %>

Total visitors since DATE DATE

 <%=Default_PageCounts%>
General page visitors  <%=general_PageCounts%>
Research page visitors  <%=research_PageCounts%>
Teaching page visitors  <%=teaching_PageCounts%>
Current Semester page visitors  <%=currentSemester_PageCounts%>
Community Services page visitors  <%=communityServices_PageCounts%>

<% Response.write HeaderTableEnd ADO.close Set ADO=Nothing %>