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

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Top 5 Posts member list in a period !??
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

DoraMoon
Average Member

Taiwan
661 Posts

Posted - 30 May 2002 :  22:56:05  Show Profile
the idea take from a MOD call Syndication, it can list the newest or most popular topics recently.
and i want to get these Top xx information together on a page....

i try the top 5 new coming members, the top 5 posts members... and so on.
(i know u just can get it by changing the members page's order, but i still want to put these together..)
but as u know, the only thing i can do about ASP is Copy and Paste...
so i just "EXTRACT" the top 5 members list from members.asp...
and unexpectedly it got to work !!!
i think it just need a simple change at SQL string... just like this..

strsql = "SELECT TOP 5 * FROM " & strMemberTablePrefix & "MEMBERS"
strSql = strSql & " ORDER BY " & strMemberTablePrefix & "MEMBERS.M_POSTS DESC, " & strMemberTablePrefix & "MEMBERS.M_NAME ASC"

but i found it really not what i want lately, about the Top 5 posts member...
for example, this forum, Richard 10527posts!!, HuwR 7403posts, Nathan 5992posts .....
i am wonder who can exceed them in a short time..

so actually i need is the Top 5 posts member IN A GIVING PERIOD...
e.g. who posts most in 7 days or 30 days nearly.

of course, i do'nt know how to add a time period to above SQL string...
(even though i think it just need .. strSql = strSql & WHERE in 30 days ..... !?? )
so can someone help me how to solve this SQL puzzle ?

thanks for help. hope this not a stupid question ..


~~ ¡¹ ¡¸ ¡¸¡¹ ¡¸ ¡¹ ~~

DoraMoon
Average Member

Taiwan
661 Posts

Posted - 04 June 2002 :  03:02:13  Show Profile
someone can tell me is it possible to do it ??
-- Top 5 members of most posts in a time period --
thx ~~


~~ ¡¹ ¡¸ ¡¸¡¹ ¡¸ ¡¹ ~~
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 04 June 2002 :  06:31:59  Show Profile  Send ruirib a Yahoo! Message
It is possible to know what you want to know, but you are not doing it the right way. You'll never find out the top posters in a period by looking at the M_POSTS field, because this field counts all posts since the member registered at the forum.

To know what you want to know, you'll need to count the number of topics and replies done by each member over a period and select the top 5 members with more topics and replies posted over that period. Since we are dealing with topics and replies this means you need to use a UNION query to do it. Here is a sample script to do it. You can pick from here:


<!--#INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="inc_functions.asp" -->
<%
Dim strSql, strConn, conn


strMydate = DateToStr(dateadd("d",-30,Now()))


strSql = " SELECT TOP 5 R_AUTHOR, M_NAME, COUNT(R_AUTHOR) AS T_POSTS FROM "
strSql = strSql & "(SELECT R_AUTHOR, M_NAME, R_DATE FROM (" & strMemberTablePrefix &"MEMBERS INNER JOIN " & strTablePrefix & "REPLY ON "
strSql = strSql & strMemberTablePrefix & "MEMBERS.MEMBER_ID="& strTablePrefix & "REPLY.R_AUTHOR) WHERE R_DATE > '" & strMyDate & "'" & vbCrLf
strSql = strSql & " UNION " & VbCrLf
strSql = strSql & "SELECT T_AUTHOR, M_NAME, T_DATE FROM (" & strMemberTablePrefix & "MEMBERS INNER JOIN " & strTablePrefix & "TOPICS ON "
strSql = strSql & strMemberTablePrefix & "MEMBERS.MEMBER_ID="& strTablePrefix & "TOPICS.T_AUTHOR) WHERE T_DATE > '" & strMyDate & "') As MyView "
strSql = strSql & "GROUP BY R_AUTHOR,M_NAME ORDER BY Count(R_AUTHOR) DESC;"


Set rs = Server.CreateObject("ADODB.Recordset")


rs.Open strSql, strConnString


While Not Rs.EOF


Response.Write rs("M_NAME") & " " & rs("T_POSTS") & "<br>"
rs.MoveNext


Wend


rs.Close



%>






-------------------------------------------------
Installation Guide | Do's and Dont's | MODs



Edited by - ruirib on 04 June 2002 07:01:20
Go to Top of Page

DoraMoon
Average Member

Taiwan
661 Posts

Posted - 04 June 2002 :  07:55:50  Show Profile
Thanks !!! ruirib

it's great ! work fine and just what i needed !
now the only thing to remain just add it into my HTML web page.. YA!!

i think the SQL query should be more complicated and profound than i though.
i'm hardly to understand what this query string meaning.. (so wonderful UNION !! )
so i will try to study this later, and learning more about SQL...

deeply appreciated your help and teach me a valuable lesson !

~~ ¡¹ ¡¸ ¡¸¡¹ ¡¸ ¡¹ ~~
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 04 June 2002 :  08:14:57  Show Profile  Send ruirib a Yahoo! Message
You are welcome .

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

DoraMoon
Average Member

Taiwan
661 Posts

Posted - 16 June 2002 :  20:05:33  Show Profile
Hi~~ (ruirib, hope you can see this... )

here is my top 5 poster file inc_topposter.txt
(i have a little change to get more information from database... and i really not sure it's correct or not, i just use the most stupid method - keep trying.. )
i include it to my default page, and it seem work very good until....

something strange... it does'nt get any problem on my PWS+Win98, but when i upload to host server, i got this error message:
Microsoft JET Database Engine Error '80040e21'
can't on SELECT sentence of UNION query using Memo¡BOLE or hyperlink object field 'M_LNEWS'¡C
/othello/forum/inc_topposter.asp, line 15

(sorry, i just translate this message from Chinese to my poor English)

and i search here about this error, there are many posts talking about blob text fields problem.... then i try to change the order of "M_LNEWS", but it seem not to work.

it's ok for me to remove the "M_LNEWS" query or just change the field property from Memo to Text. but i still want to know...

is it just the server problem ?? or something mistake in my including file ??

thanks if someone can teach me more about these SQL knowledge.


~~ ¡¹ ¡¸ ¡¸¡¹ ¡¸ ¡¹ ~~

Edited by - DoraMoon on 17 June 2002 02:11:48
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 16 June 2002 :  20:10:42  Show Profile  Send ruirib a Yahoo! Message
That was not in my original query, so why did you add it?

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

DoraMoon
Average Member

Taiwan
661 Posts

Posted - 16 June 2002 :  20:51:21  Show Profile
Thank ruirib for quick reply ...

i just want to "call out" more data information by this query,
so it not just show the M_NAME & T_POSTS only.

and in fact, now the only thing i can do, just call more field i needed from the MEMBERS table. i have no idea how to get data from another tables by using UNION query...

i do'nt know is it right or wrong, but it really take effect on my PWS computer. just get error when i put it on hosting server.


~~ ¡¹ ¡¸ ¡¸¡¹ ¡¸ ¡¹ ~~
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 16 June 2002 :  21:47:37  Show Profile  Send ruirib a Yahoo! Message
You can call more fields from the members table, but you need to call the same fields in the same order in both sides of the UNION keyword, so to speak...



-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 16 June 2002 :  23:56:17  Show Profile  Visit dayve's Homepage
I've been meaning to do this for a long time.
Thanks for doing all the work ;)

stripped down versin of my results... (needs formatting)

http://www.nineinchnailz.com/forum/test1.asp


http://www.nineinchnailz.com
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 16 June 2002 :  23:59:32  Show Profile  Send ruirib a Yahoo! Message
You're welcome .

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 17 June 2002 :  13:48:56  Show Profile  Visit dayve's Homepage
here is somewhat of the direction I am going to take this...
posts by month/year, here is an example...
there will be more to it than this but this is to give
everyone an idea..

http://www.nineinchnailz.com/forum/test2.asp


http://www.nineinchnailz.com

Edited by - dayve on 17 June 2002 14:31:21
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 17 June 2002 :  14:25:37  Show Profile  Send ruirib a Yahoo! Message
It's looking good dayve .



-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 17 June 2002 :  14:34:28  Show Profile  Send ruirib a Yahoo! Message
quote:

i just want to "call out" more data information by this query,
so it not just show the M_NAME & T_POSTS only.

and in fact, now the only thing i can do, just call more field i needed from the MEMBERS table. i have no idea how to get data from another tables by using UNION query...


Dora,

If you look at the SQL statement attentively you'll notice that what you really have is two different queries, unioned together by the UNION keyword. The "requirement" to unite two different queries is that the queries have the same number of returned columns and that you choose "equivalent" (the word is bad, but that's what I can think of now) fields to be returned in the same position in both queries.
In the current query you have : R_AUTHOR->T_AUTHOR, M_NAME->M_NAME, R_DATE->T_DATE. All these are "equivalent".

You can change both queries to include additional fields from the same tables or joined from addtional tables, as long as they respect these rules.

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 23 June 2002 :  23:36:49  Show Profile  Visit dayve's Homepage
Is this worthy of posting as a mod? I guess
it depends on how many people would be interested
in having this...

http://www.nineinchnailz.com/forum/pop_top_20.asp



suggestions are welcome on enhancing this. thanks.


http://www.nineinchnailz.com

Edited by - dayve on 24 June 2002 02:00:19
Go to Top of Page

HarshReality
Junior Member

USA
128 Posts

Posted - 23 June 2002 :  23:55:21  Show Profile  Visit HarshReality's Homepage  Send HarshReality an AOL message  Send HarshReality an ICQ Message  Send HarshReality a Yahoo! Message
little things maybe, have member name goto the profile. Have the post count be a link to the members last post. I am full of silly ideas like that.....


Anti Social Personality
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 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.27 seconds. Powered By: Snitz Forums 2000 Version 3.4.07