Author |
Topic |
|
Striker
Starting Member
4 Posts |
Posted - 14 March 2002 : 19:47:13
|
In default.asp, the following code is "remmed" out. If you remove the rems, it adds a line to stats, but the count is VERY much off. On my website, update counts tells me I have around 11,000 archived messages, but this code tells me I have like 200,000. The board isn't that busy. Has anyone been able to make this code work properly?
ArchivedPostCount = 0 ArchivedTopicCount = 0 ' if not blnHiddenForums then '## Forum_SQL - Get ActiveTopicCount from DB ' strSql = "SELECT COUNT(" & strArchiveTablePrefix & "REPLY.REPLY_ID) AS NUM_REPLY_ARCHIVED, " &_ ' "COUNT(" & strArchiveTablePrefix & "TOPICS.TOPIC_ID) AS NUM_TOPIC_ARCHIVED " &_ ' " FROM " & strArchiveTablePrefix & "REPLY, " &_ ' strArchiveTablePrefix & "TOPICS " ' ' Set rs = Server.CreateObject("ADODB.Recordset") ' rs.open strSql, my_Conn
' if not rs.EOF then ' ArchivedPostCount = rs("NUM_REPLY_ARCHIVED") + rs("NUM_TOPIC_ARCHIVED") ' ArchivedTopicCount = rs("NUM_TOPIC_ARCHIVED") ' else ' ArchivedPostCount = 0 ' ArchivedTopicCount = 0 ' end if ' end if
' rs.close ' set rs = nothing
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 14 March 2002 : 20:11:04
|
try this:
ArchivedPostCount = 0 ArchivedTopicCount = 0 if not blnHiddenForums then '## Forum_SQL strSql = "SELECT P_A_COUNT, T_A_COUNT FROM " & strTablePrefix & "TOTALS" Set rs = Server.CreateObject("ADODB.Recordset") rs.open strSql, my_Conn if not rs.EOF then ArchivedPostCount = rs("P_A_COUNT") ArchivedTopicCount = rs("T_A_COUNT") else ArchivedPostCount = 0 ArchivedTopicCount = 0 end if rs.Close set rs = nothing end if |
|
|
Striker
Starting Member
4 Posts |
Posted - 14 March 2002 : 20:26:21
|
Perfect and works like a charm. Thanks !!!
Wouldn't happen to know how to get it to put a comma in the right place so:
There are 11045 archived posts in 1146 archived topics
Reads as:
There are 11,045 archived posts in 1,146 archived topics
|
|
|
Nathan
Help Moderator
USA
7664 Posts |
Posted - 14 March 2002 : 21:09:35
|
The computer is printing numbers, not strings. The computer doesn't think of numbers as having commas, they are just numbers.
If you want commas you can make a function that converts the number into a string then counts the number of digits in the string and inserts commas at the approprate locations. (Don't ask me how to do this though, I have never sat down and learned how to use the VBScript string manipulation functions.)
Nathan Bales - Romans 15:13 ---------------------------------- Snitz Exchange | Do's and Dont's |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
|
Striker
Starting Member
4 Posts |
Posted - 14 March 2002 : 21:36:04
|
Ok ... that worked ... added a function to the end of default.asp and run the numbers through it. Much easier in regular VB with the Format command
Thanks for all the help Richard!
|
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 14 March 2002 : 21:44:06
|
wouldn't this have been easier ?
ArchivedPostCount = FormatNumber(rs("P_A_COUNT"),0)
www.daoc-halo.com
Edited by - Gremlin on 14 March 2002 21:46:58 |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 14 March 2002 : 22:06:09
|
Not exactly the clearest documentation there is it !
According to my book it will use the regional settings for numeric display, which I guess normally would be commas for most languages.
www.daoc-halo.com |
|
|
Nathan
Help Moderator
USA
7664 Posts |
Posted - 15 March 2002 : 01:03:57
|
Grab a pre-made function off the internet. . . . why didn't I think of that!
Nathan Bales - Romans 15:13 ---------------------------------- Snitz Exchange | Do's and Dont's |
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 15 March 2002 : 01:24:45
|
I dunno, but theres an inbuilt function that does it anyway Nathan
www.daoc-halo.com |
|
|
|
Topic |
|