Print Page | Close Window

Post in forum, from outside forum.

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=20377
Printed Date: 11 April 2026 at 10:09am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Post in forum, from outside forum.
Posted By: BrownGhost
Subject: Post in forum, from outside forum.
Date Posted: 20 June 2006 at 10:19pm

Post in forum, from outside forum.

 

We have made a function in version 7.1 where visitors could comment news written on my page.

When selecting to comment a post was made in forum, in a category we already have decided what was. And it would post as the news writer as we include his id and stuff.

All working great.

 

Now after we have updated to V 8.2 this function still works, except, the post don’t show op in the forum, if you select that category. If I track the post via ID I can see its there. But its not showing up in forum. I know what the problem is, but don’t how to fix it.

 

The problem was when we make a post in forum via our news page it did not create: Start_Thread_ID Last_Thread_ID

 

So I try the code below to fix that problem.

Works until some one deletes a post, then its not right any more.

 

Lets say Thread_ID 12 was deleted.

Then next Thread_ID will be 13
But my code will look in forum see that 11 is there + 1 and assume its 12.

And use 12 for my post :(

 

 

 

            strSQL = "SELECT Max(Thread_ID+1) AS ID FROM tblThread"

            lngThreadID = objConn.Execute(strSQL)("ID")

           

           

            strSQL = _

                        "INSERT INTO tblTopic(Forum_ID,Poll_ID,Moved_ID,Subject,Start_Date,Last_Entry_Date,No_Of_Views,Locked,Priority,NewsID,Start_Thread_ID,Last_Thread_ID) " & _

                        "VALUES("& intForumID &",0,0,'" & strTitleName & "',GetDate(),GetDate(),0,0,0," & lngNewsID & "," & lngThreadID & "," & lngThreadID & ")"

            objConn.Execute strSQL

           

           

            strSQL = "SELECT Max(Topic_ID) AS ID FROM tblTopic"

            lngTopicID = objConn.Execute(strSQL)("ID")

           

            strSQL = _

                        "INSERT INTO tblThread(Topic_ID,Author_ID,Message,Message_Date,Show_Signature,IP_Addr) " & _

                        "VALUES(" & lngTopicID & "," & strTeamUserID & ",'" & strTeaser & "',GetDate(),0,'')"

            objConn.Execute strSQL

 

 

Can you think of a way i can fix this problem?

Thanks a lot.




Replies:
Posted By: WebWiz-Bruce
Date Posted: 21 June 2006 at 10:24am
Have a look in the files new_post.asp, and delete_post.asp handle the insert and deletion of posts. This should give you some idea of what to do.

-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: BrownGhost
Date Posted: 21 June 2006 at 6:30pm
Humm that gave me an idear for, changing my code at bit. its now working..

strSQL = _
        "INSERT INTO tblTopic(Forum_ID,Poll_ID,Moved_ID,Subject,Start_Date,Last_Entry_Date,No_Of_Views,Locked,Priority,NewsID) " & _
        "VALUES("& intForumID &",0,0,'" & strTitleName & "',GetDate(),GetDate(),0,0,0," & lngNewsID & ")"
    objConn.Execute strSQL
   
   
    strSQL = "SELECT Max(Topic_ID) AS ID FROM tblTopic"
    lngTopicID = objConn.Execute(strSQL)("ID")
   
    strSQL = _
        "INSERT INTO tblThread(Topic_ID,Author_ID,Message,Message_Date,Show_Signature,IP_Addr) " & _
        "VALUES(" & lngTopicID & "," & strTeamUserID & ",'" & strTeaser & "',GetDate(),0,'')"
    objConn.Execute strSQL
Else
    lngTopicID = rsTopic("Topic_ID")
End If

   
    strSQL = "SELECT Max(Thread_ID) AS ID FROM tblThread"
    lngThreadID = objConn.Execute(strSQL)("ID")


strSQL = "UPDATE tblTopic SET Start_Thread_ID=" & lngThreadID & ", Last_Thread_ID=" & lngThreadID & " WHERE Topic_ID=" & lngTopicID
        objConn.Execute strSQL

Response.Redirect "/forum/forum_posts.asp?TID=" & lngTopicID


Now i set the Start_Thread_ID and Last_Thread_ID at the end of my code.
But Qcustion is, what if some other user makes new thred at the same time ??

Can i Lock the tabel until im don running my code..
And how do one do this?

Thx
im not proff programmer as you, so i need some help.


Posted By: WebWiz-Bruce
Date Posted: 21 June 2006 at 7:18pm
It should be fine how it is.

If by some 1 million to 1 chance another user posted at the same time as you and the database updated their stats in a million second before yours then you would just have the wrong poster displayed as the last poster in that topic, this will be updated when a new user posts or you use the admin button to update the topic.

By the way for performance reasons the database isn't locked during this process in version 8 anyway.

Most 'updates' are now row locks, and most 'reads' are now 'dirty' reads were the database is not locked during the read. This hasn't seemed to create a problem, but does increase performance.


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: BrownGhost
Date Posted: 21 June 2006 at 7:37pm
okay then its not realy a problem. all is good, and i want to thank you for all your help.. :)

Making a new site for a costumer of mine thy want forum also, so im buying more forum later this week :)

thanks...


Posted By: WebWiz-Bruce
Date Posted: 22 June 2006 at 10:18am
Cool 

-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting



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