Print Page | Close Window

Mod: latest postings (Mysql)

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=22139
Printed Date: 30 March 2026 at 3:03pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Mod: latest postings (Mysql)
Posted By: Ivar
Subject: Mod: latest postings (Mysql)
Date Posted: 07 December 2006 at 7:14am
I got it.
This mod shows the latest x postings and can be placed in the default.

1:
Copy the following text and save this as mod_latest_posts.asp in the includes.
 

<table cellspacing="1" cellpadding="3" class="tableBorder" align="center">

<tr class="tableLedger">

<td colspan="4">Recente berichten</td>

</tr>

<tr class="tableSubLedger">

<td width="40%"><% = strTxtTopics %></td>

<td width="20%" align="center"><% = strTxtForum %></td>

<td width="20%" align="center"><% = strTxtAuthor %></td>

<td width="20%" align="center"><% = strTxtDatePosted %></td>

</tr>

<%

'Mod by Venky, http://venki.seccomnetworks.net, hrvojevencl@gmail.com

'reset some variavles

intTempRecord = 0

intTotalRecords = 0

strSQL = "SELECT "

If strDatabaseType = "SQLServer" OR strDatabaseType = "Access" Then strSQL = strSQL & " TOP 15 "

strSQL = strSQL & strDbTable & "Thread.Thread_ID, " & strDbTable & "Topic.Topic_ID, " & strDbTable & "Thread.Message, " & strDbTable & "Topic.Subject, " & strDbTable & "Author.Author_ID, " & strDbTable & "Thread.Message_date, " & strDbTable & "Author.Username, " & strDbTable & "Forum.Forum_name " & _

"FROM " & strDbTable & "Topic" & strDBNoLock & ", " & strDbTable & "Thread" & strDBNoLock & ", " & strDbTable & "Author" & strDBNoLock & ", " & strDbTable & "Forum" & strDBNoLock & ", " & strDbTable & "Permissions " & strDBNoLock & " " & _

"WHERE " & strDbTable & "Forum.Forum_ID = " & strDbTable & "Topic.Forum_ID " & _

"AND " & strDbTable & "Topic.Topic_ID = " & strDbTable & "Thread.Topic_ID " & _

"AND " & strDbTable & "Author.Author_ID = " & strDbTable & "Thread.Author_ID " & _

"AND " & strDbTable & "Topic.Last_Thread_ID = " & strDbTable & "Thread.Thread_ID " & _

"AND " & strDbTable & "Forum.Forum_ID = " & strDbTable & "Permissions.Forum_ID " & _

"AND ((" & strDbTable & "Permissions.Group_ID = " & intGroupID & " OR " & strDbTable & "Permissions.Author_ID = " & lngLoggedInUserID & ") AND " & strDbTable & "Permissions.View_Forum = " & strDBTrue & ") " & _

"AND (" & strDbTable & "Forum.Password = '' OR " & strDbTable & "Forum.Password Is Null) AND (" & strDbTable & "Topic.Hide = " & strDBFalse & " AND " & strDbTable & "Thread.Hide = " & strDBFalse & ") "

'Order by cluase

strSQL = strSQL & " ORDER BY " & strDbTable & "Thread.Message_date DESC "

If strDatabaseType = "mySQL" Then strSQL = strSQL & " LIMIT 15 "

strSQL = strSQL & ";"

'Set error trapping

On Error Resume Next

'Query the database

rsCommon.Open strSQL, adoCon

'If an error has occured write an error to the page

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

'Disable error trapping

On Error goto 0

 

'Place the recordset into an array

If NOT rsCommon.EOF Then

'Read the recordset into an array

saryLastPosts = rsCommon.GetRows()

'read total records

intTotalRecords = Ubound(saryLastPosts,2) + 1

End If

'Close recordset

rsCommon.close

'saryMembersToday(2, intTempRecord)

'display

if intTotalRecords = 0 then

Response.Write("<tr class=""tableRow""><td colspan=""3"">" & strTxtNoForumPostMade & "</td></tr>")

else

Do While intTempRecord < intTotalRecords

saryLastPosts(2, intTempRecord) = removeHTML(saryLastPosts(2, intTempRecord), 150, true)

Response.Write "<tr class=""tableRow""><td><a href=""forum_posts.asp?TID=" & saryLastPosts(1, intTempRecord) & """><img border=""0"" src=""" & strImagePath & "right_arrow.gif"" /></a>&nbsp;<a href=""forum_posts.asp?TID=" & saryLastPosts(1, intTempRecord) & "&get=last#" & saryLastPosts(0, intTempRecord) & """ title=""" & formatInput(saryLastPosts(2, intTempRecord)) & """>" & formatInput(saryLastPosts(3, intTempRecord)) & "</a></td><td align=""center"">" & saryLastPosts(7, intTempRecord) & "</td><td align=""center""><a href=""member_profile.asp?PF=" & saryLastPosts(4, intTempRecord) & """ oncontextmenu=""ShowUserMenu('" & saryLastPosts(4, intTempRecord) & "', '" & saryLastPosts(6, intTempRecord) & "'); return false;"">" & saryLastPosts(6, intTempRecord) & "</a></td><td align=""center"">" & DateFormat(saryLastPosts(5, intTempRecord)) & " - " & TimeFormat(saryLastPosts(5, intTempRecord)) & "</td></tr>"

'Move to next record

intTempRecord = intTempRecord + 1

Loop

End if

%>

</table>


2:
Place the line:

<!--#include file="includes/mod_latest_posts.asp" -->

in the default there were you want the summary.
 
For an example, see the bottom at: http://www.reiki-lotus.com/forum/default.asp - http://www.reiki-lotus.com/forum/default.asp
 
Smile
 
 



Replies:
Posted By: kpdillon
Date Posted: 31 December 2006 at 2:49am
I get the following error.  Any ideas?
 
Server Error in Forum Application
An error has occured while executing SQL query on database.
Please contact the forum administrator.

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

Error details:-
Microsoft VBScript runtime error
Object required


Posted By: kpdillon
Date Posted: 31 December 2006 at 7:10am
I was able to get it working by adding
 
dim saryLastPosts
 
in the above code.


Posted By: -koen-
Date Posted: 31 December 2006 at 8:57am
kpdillon,
The error was created by your database.
Find the code

'Clean up
Call closeDatabase()


and delete that,
Add after

<!--#include file="includes/mod_latest_posts.asp" -->

This

<%
'Clean up
Call closeDatabase()
%>

Edit:

I found some bugs,
  1. Some post are double listed (Found solution, there double listed if its a new topic...)
  2. There isn't say anything about the database conn
  3. Dim saryLastPosts must be added



-------------
Don't check me english spelling please...


Posted By: Pfeff
Date Posted: 13 January 2007 at 5:50pm
Any ideas?

Microsoft VBScript runtime error '800a01a8'

Object required: 'rsCommon'

/includes/mod_latest_posts.asp, line 70





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