Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Mod: latest postings (Mysql)
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Mod: latest postings (Mysql)

 Post Reply Post Reply
Author
Ivar View Drop Down
Groupie
Groupie


Joined: 24 November 2002
Location: Netherlands
Status: Offline
Points: 114
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ivar Quote  Post ReplyReply Direct Link To This Post Topic: Mod: latest postings (Mysql)
    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
 
Smile
 
 


Edited by Ivar - 08 December 2006 at 7:11am
Back to Top
kpdillon View Drop Down
Groupie
Groupie


Joined: 29 December 2006
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote kpdillon Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
kpdillon View Drop Down
Groupie
Groupie


Joined: 29 December 2006
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote kpdillon Quote  Post ReplyReply Direct Link To This Post Posted: 31 December 2006 at 7:10am
I was able to get it working by adding
 
dim saryLastPosts
 
in the above code.
Back to Top
-koen- View Drop Down
Groupie
Groupie
Avatar

Joined: 22 February 2006
Location: Netherlands
Status: Offline
Points: 54
Post Options Post Options   Thanks (0) Thanks(0)   Quote -koen- Quote  Post ReplyReply Direct Link To This Post 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



Edited by -koen- - 31 December 2006 at 12:16pm
Don't check me english spelling please...
Back to Top
Pfeff View Drop Down
Newbie
Newbie


Joined: 17 October 2006
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pfeff Quote  Post ReplyReply Direct Link To This Post Posted: 13 January 2007 at 5:50pm
Any ideas?

Microsoft VBScript runtime error '800a01a8'

Object required: 'rsCommon'

/includes/mod_latest_posts.asp, line 70


Back to Top
 Post Reply Post Reply

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.