Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 Another Database SELECT question
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

golfmann
Junior Member

United States
450 Posts

Posted - 06 March 2006 :  19:48:20  Show Profile  Visit golfmann's Homepage
I have a menu line in my header and when we post in a private room, it increases the count in the active topics on this menu line. The active topics mod does NOT show the private post, so my members are questioning why the menu line says three, say and active topics has two! This is not good as is hurting some feelings.
Can somebody look at this code and tell me how or what's wrong so I can drop private forums from the count in this menu code?
MUCH thanks if you can...
ActiveTopicCount = -1
if IsEmpty(Session(strCookieURL & "last_here_date")) then
Session(strCookieURL & "last_here_date") = ReadLastHereDate(strDBNTUserName)
end if
if not IsNull(Session(strCookieURL & "last_here_date")) then 
if not blnHiddenForums then <this is only mentioned once, here...  what's this?
'## Forum_SQL - Get ActiveTopicCount from DB
strSql = "SELECT COUNT(" & strTablePrefix & "TOPICS.T_LAST_POST) AS NUM_ACTIVE "
strSql = strSql & "FROM " & strTablePrefix & "TOPICS "
strSql = strSql & "WHERE (((" & strTablePrefix & "TOPICS.T_LAST_POST)>'"& Session(strCookieURL & "last_here_date") & "'))"
strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_STATUS <= 1"
strSql = strSql & " AND " & strTablePrefix & "FType <> 0"

set rs = my_Conn.Execute(strSql)

if not rs.EOF then
ActiveTopicCount = rs("NUM_ACTIVE")
else
ActiveTopicCount = 0
end if
end if
end if
rs.close

set rs = nothing


example of menu line:
http://www.wethepeopleforum.com/forum/active.asp

Edited by - golfmann on 06 March 2006 22:07:52

dayve
Forum Moderator

USA
5820 Posts

Posted - 06 March 2006 :  22:05:19  Show Profile  Visit dayve's Homepage
in the private category, just turn off post count incrementing.


Go to Top of Page

golfmann
Junior Member

United States
450 Posts

Posted - 07 March 2006 :  00:35:53  Show Profile  Visit golfmann's Homepage
I did that and it still does it in this menu thing!
That's what has me ??????
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20600 Posts

Posted - 07 March 2006 :  04:01:58  Show Profile  Visit HuwR's Homepage
turning off post count won't work since the code golfmann is posting is actually doing a count on the db. to stop it you will need to adjust the where clause of the query so that is does not count topics from the hidden forum.

so just add a line like below to the end of the query

strSql = strSql & " AND " & strTablePrefix & "FORUM_ID <> XXXXX"

where XXXXX is your hidden forum id, if you have more than one, then do something like

strSql = strSql & " AND " & strTablePrefix & "FORUM_ID NOT IN (XXXX,YYYY,ZZZZ)"

Go to Top of Page

golfmann
Junior Member

United States
450 Posts

Posted - 07 March 2006 :  12:02:27  Show Profile  Visit golfmann's Homepage
Thank you Huw.
THAT'S what I was looking for.
that bool blnHiddenForums was worthless in this code it seems, anyway, did nuttin' dim'd or not

Thanks again!

Edited by - golfmann on 07 March 2006 12:05:12
Go to Top of Page

golfmann
Junior Member

United States
450 Posts

Posted - 07 March 2006 :  12:22:16  Show Profile  Visit golfmann's Homepage
ok, inserted the code and get this (which is what got me here in the first place trying things)
Microsoft OLE DB Provider for SQL Server error '80040e14'

Invalid column name 'FORUM_FORUM_ID'.

/forum/inc_header.asp, line 703


using this code:
'## Forum_SQL - Get ActiveTopicCount from DB
strSql = "SELECT COUNT(" & strTablePrefix & "TOPICS.T_LAST_POST) AS NUM_ACTIVE "
strSql = strSql & "FROM " & strTablePrefix & "TOPICS "
strSql = strSql & "WHERE (((" & strTablePrefix & "TOPICS.T_LAST_POST)>'"& Session(strCookieURL & "last_here_date") & "'))"
strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_STATUS <= 1"
strSql = strSql & " AND " & strTablePrefix & "FORUM_ID NOT IN (12,15)"


what ignorance am I showing now!!!??? :)

Edited by - golfmann on 07 March 2006 20:39:29
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20600 Posts

Posted - 08 March 2006 :  03:11:28  Show Profile  Visit HuwR's Homepage
should be TOPICS.FORUM_ID not just FORUM_ID
Go to Top of Page

golfmann
Junior Member

United States
450 Posts

Posted - 08 March 2006 :  11:09:05  Show Profile  Visit golfmann's Homepage
Doh!
Go to Top of Page

golfmann
Junior Member

United States
450 Posts

Posted - 08 March 2006 :  11:24:29  Show Profile  Visit golfmann's Homepage
Works great! Thanks again Mr. R...
Best thing since sliced bread.

BTW, what was the best thing BEFORE there was sliced bread?
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20600 Posts

Posted - 08 March 2006 :  12:16:05  Show Profile  Visit HuwR's Homepage
quote:
Originally posted by golfmann

Works great! Thanks again Mr. R...
Best thing since sliced bread.

BTW, what was the best thing BEFORE there was sliced bread?


unsliced bread
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.31 seconds. Powered By: Snitz Forums 2000 Version 3.4.07