Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - MOD: Top 10 Posters
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

MOD: Top 10 Posters

 Post Reply Post Reply Page  123>
Author
Ali Bilgrami View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 April 2005
Location: Pakistan
Status: Offline
Points: 492
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ali Bilgrami Quote  Post ReplyReply Direct Link To This Post Topic: MOD: Top 10 Posters
    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


Edited by Ali Bilgrami - 17 January 2007 at 11:16am
Lets!
Back to Top
MrMellie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 December 2006
Location: United Kingdom
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote MrMellie Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Ali Bilgrami View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 April 2005
Location: Pakistan
Status: Offline
Points: 492
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ali Bilgrami Quote  Post ReplyReply Direct Link To This Post 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!
Back to Top
MrMellie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 December 2006
Location: United Kingdom
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote MrMellie Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Ali Bilgrami View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 April 2005
Location: Pakistan
Status: Offline
Points: 492
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ali Bilgrami Quote  Post ReplyReply Direct Link To This Post 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!
Back to Top
MrMellie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 December 2006
Location: United Kingdom
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote MrMellie Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Ali Bilgrami View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 April 2005
Location: Pakistan
Status: Offline
Points: 492
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ali Bilgrami Quote  Post ReplyReply Direct Link To This Post Posted: 20 January 2007 at 10:39am

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

Lets!
Back to Top
mconway72 View Drop Down
Newbie
Newbie


Joined: 26 September 2006
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote mconway72 Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply Page  123>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.