Print Page | Close Window

MOD: Top 10 Posters

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums Modifications
Forum Description: Mod's and Add-on's for Web Wiz Forums.
URL: https://forums.webwiz.net/forum_posts.asp?TID=22413
Printed Date: 30 March 2026 at 5:57am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: MOD: Top 10 Posters
Posted By: Ali Bilgrami
Subject: MOD: Top 10 Posters
Date Posted: 14 January 2007 at 10:13pm
i think its working fine now thanks to mr.mellie 
 
so first thing you do is define a variable in dimension variables list in the start of default.asp...
 
Dim saryTopPosters 'top poster 
 
now find this code

'If we have run out of records jump out of forums loop into the category loop
    If intCurrentRecord > Ubound(sarryForums,2) Then Exit Do
   Loop 
  End If
  
 
 %>
</table>
<br /><%
    
 'Loop back round for next category
 Loop
End If
 
'Clean up
Call closeDatabase()
%>
just above the Clean up call paste the code give below
 
<!-- Top 10 posters -->
<table cellspacing="1" cellpadding="3" class="tableBorder" align="center">
<tr class="tableLedger">
<td colspan="10">Top 10 Posters</td>
</tr>
<%
intTempRecord = 0
intTotalRecords = 0
Const strMBV_TP_R = 10
strSQL = "SELECT "
strSQL = strSQL & " TOP " & strMBV_TP_R & " "
strSQL = strSQL & strDbTable & "Author.Author_ID, " & strDbTable & "Author.Username, " & strDbTable & "Author.Group_ID, " & strDbTable & "Author.Last_visit, " & strDbTable & "Author.No_of_posts, " & strDbTable & "Author.Join_date, " & strDbTable & "Author.Active, " & strDbTable & "Group.Name, " & strDbTable & "Author.Avatar " & _
"FROM " & strDbTable & "Author " & strDBNoLock & ", " & strDbTable & "Group " & strDBNoLock & " " & _
"WHERE " & strDbTable & "Author.Group_ID = " & strDbTable & "Group.Group_ID AND " & strDbTable & "Author.Active = " & strDbTrue & " " & _
"ORDER BY " & strDbTable & "Author.No_of_posts DESC; "

On Error Resume Next

rsCommon.Open strSQL, adoCon

'If Err.Number <> 0 Then Call errorMsg("An error has occured while executing SQL query on database.", "get_last_USR_+_count", "default.asp")

On Error goto 0

'Place the recordset into an array
If NOT rsCommon.EOF Then

'Read the recordset into an array
saryTopPosters = rsCommon.GetRows()

'read total records
intTotalRecords = Ubound(saryTopPosters,2) + 1
End If

'Close recordset
rsCommon.close

if intTotalRecords = 0 then
Response.Write("<tr class=""tableRow""><td colspan=""10"">" & strTxtNoForumPostMade & "</td></tr>")
else
%>
<tr class="tableRow" align="center"><%
Do While intTempRecord < intTotalRecords
if intTempRecord = 10 then exit Do
Response.Write("<td><a href=""member_profile.asp?PF=" & saryTopPosters(0, intTempRecord) & strQsSID2 & saryTopPosters(0, intTempRecord) & "', '" & saryTopPosters(1, intTempRecord) & "')""><img src=""" & saryTopPosters(8, intTempRecord) & """ alt=""" & strTxtType & ": " & saryTopPosters(2, intTempRecord) & vbCrlf & strTxtPosts & ": " & saryTopPosters(4, intTempRecord) & vbCrlf & strTxtLastActive & ": " & DateFormat(saryTopPosters(3, intTempRecord)) & """ class=""avatar"" onError=""this.src='avatars/blank_avatar.jpg';""><br />" & saryTopPosters(1, intTempRecord) & "</a></td>")
intTempRecord = intTempRecord + 1
Loop
%>
</tr>

</table>
<% End if %>
<br />

<!-- End Top 10 Posters -->
and off u go Wink


-------------
Lets!



Replies:
Posted By: MrMellie
Date Posted: 15 January 2007 at 12:01pm
I would say there is an error in your SQL query string, so rsCommon is not pulling anything back, hence the error.

Try putting "Response.Write strSQL" (no quotes..) on the line before the On Error command, immediately after building the strSQL string. Then you can see what SQL command you are trying to open in rsCommon and hopefully spot the error.


Posted By: Ali Bilgrami
Date Posted: 17 January 2007 at 9:57am
did that...got this
SELECT TOP 10 tblAuthor.Author_ID, tblAuthor.Username, tblAuthor.Group_ID, tblAuthor.Last_visit, tblAuthor.No_of_posts, tblAuthor.Join_date, tblAuthor.Active, tblGroup.Name, tblAuthor.Avatar FROM tblAuthor WITH (NOLOCK) , tblGroup WITH (NOLOCK) WHERE tblAuthor.Group_ID = tblGroup.Group_ID AND tblAuthor.Active = 1 ORDER BY tblAuthor.No_of_posts DESC;
Server Error in Forum Application
An error has occured while executing SQL query on database.
Please contact the forum administrator.

Support Error Code:- err_SQLServer_get_last_USR_+_count
File Name:- default.asp

Error details:-
Microsoft VBScript runtime error
Object required


-------------
Lets!


Posted By: MrMellie
Date Posted: 17 January 2007 at 10:07am
Ok, the query works when run directly on my database so no problems there. From that second error report, I take it you have inserted the code in your first post in to default.asp? Have you put it in after the Call CloseDatabase() command? If so the rsCommon object has been cleared. You'll need to comment out the move Close Database line and add it in again after your new bit of code.


Posted By: Ali Bilgrami
Date Posted: 17 January 2007 at 10:35am

thanks man..works like a charm...just one tiny thing how do i keep it in the page size...cuz its going out of the bounds



-------------
Lets!


Posted By: MrMellie
Date Posted: 17 January 2007 at 1:06pm
How do you mean it's going out of bounds? I pasted into my default.asp and it's all appearing on the screen ok.

You might want to add a %> at the begining of the code and a <% at the end to make it slot in properly where you are saying.


Posted By: Ali Bilgrami
Date Posted: 20 January 2007 at 10:39am

yeah...found tht out...kinda missed one LOL Thanks mate



-------------
Lets!


Posted By: mconway72
Date Posted: 19 March 2007 at 7:34pm
Does anyone have the complete code for this?  I hate being fed only part of a thread ... must have missed something in this code.  The entire code would be appreciated.


Posted By: Ali Bilgrami
Date Posted: 19 March 2007 at 10:38pm
this is the complete code. & its working fine at my forum...there must be some step u missed.

-------------
Lets!


Posted By: freakyfred
Date Posted: 29 March 2007 at 7:30pm
Is this for sql version? i'm not a programmer in any way of form and did do a search for it on my default.asp but it returned nothing.


Posted By: MrMellie
Date Posted: 29 March 2007 at 8:56pm
It should work with Access or SQL Server. It will need tweaking for MySQL.


Posted By: freakyfred
Date Posted: 30 March 2007 at 1:07pm
would it be possible for someone to post the final file? i have looked for that code on default.asp on my access version but cannot find it? maybe someone could post it in the mod index? thanks.


Posted By: MrMellie
Date Posted: 04 April 2007 at 9:16am
What Ali has posted is the final file! I've tried it out and it works just fine.


Posted By: freakyfred
Date Posted: 05 April 2007 at 12:10pm
[QUOTE=Ali Bilgrami]
i think its working fine now thanks to mr.mellie 
 
so first thing you do is define a variable in dimension variables list in the start of default.asp...
 
Dim saryTopPosters 'top poster 
 
now find this code
'If we have run out of records jump out of forums loop into the category loop
    If intCurrentRecord > Ubound(sarryForums,2) Then Exit Do
   Loop 
  End If
  
 
 %>
</table>
<br /><%
    
 'Loop back round for next category
 Loop
End If
 
'Clean up
Call closeDatabase()
%>
just above the Clean up call paste the code give below
 


That above code is not in my access version?


Posted By: Ali Bilgrami
Date Posted: 08 April 2007 at 6:56pm
it is not possible that u cant find clean up call... since mine is MSSQL DB so i pasted that code...open the default.asp in note pad and find
 
Call closeDatabase()
 
paste the code above it.


-------------
Lets!


Posted By: freakyfred
Date Posted: 10 April 2007 at 2:43pm
i have and it does exist but the code is dirent. i am no programmer or expert.


Posted By: freakyfred
Date Posted: 10 April 2007 at 2:57pm
Apologies. I realise what you were saying now. I am still learning but getting there. works a treat. thanks for your help.


Posted By: Ali Bilgrami
Date Posted: 13 April 2007 at 1:35pm
its all good mate...cheers

-------------
Lets!


Posted By: freakyfred
Date Posted: 13 April 2007 at 2:17pm
i did get 1 error though. When i installed it and clicked on the member there seemd to be alot of extra stuff in the url.. i strippd it out and now it works fine? That is for my access version.


Posted By: Acke
Date Posted: 05 May 2007 at 7:49pm
What did you do to fix this???
 
I have the same problems that you have freakyfred
I you past your fix here so maybe this can help other with same problem.
 
Acke



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net