Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Help with SQL - New Topic

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
StephenD Posted - 21 August 2005 : 02:18:56
I've got a custom table in my snitz db that I need to link to the Topics table by TOPIC_ID. How do I pass the TOPIC_ID in an INSERT INTO NEWTABLE statement .. the same time the topic or TOPIC_ID is created in post_info.asp?<
2   L A T E S T    R E P L I E S    (Newest First)
StephenD Posted - 23 August 2005 : 05:37:03
Thank you Etymon for the detailed answer. I'll give it a shot later tonight.
Cheers.
<
Etymon Posted - 23 August 2005 : 05:00:25
quote:
Originally posted by StephenD

I've got a custom table in my snitz db that I need to link to the Topics table by TOPIC_ID. How do I pass the TOPIC_ID in an INSERT INTO NEWTABLE statement .. the same time the topic or TOPIC_ID is created in post_info.asp?



Hi Stephen,

Look in post_info.asp for NewTopicID

In Snitz 3.4.05 the code looks like this:


		strSql = "SELECT Max(TOPIC_ID) as NewTopicID "
		strSql = strSql & " FROM " & strActivePrefix & "TOPICS "
		strSql = strSql & " WHERE FORUM_ID = " & Forum_ID
		strSql = strSql & "   and T_AUTHOR = " & rs("MEMBER_ID")
		set rs9 = my_Conn.Execute (strSql)
		NewTopicID = rs9("NewTopicID")
		rs9.close
		set rs9 = nothing

		' DEM --> Do not update forum count if topic is moderated.... Added if and end if
        	if Moderation = "No" then
			'## Forum_SQL - Increase count of topics and replies in Forum table by 1
			strSql = "UPDATE " & strTablePrefix & "FORUM "
			strSql = strSql & " SET F_LAST_POST = '" & DateToStr(strForumTimeAdjust) & "'"
			strSql = strSql & ",    F_TOPICS = F_TOPICS + 1"
			strSql = strSql & ",    F_COUNT = F_COUNT + 1"
			strSql = strSql & ",    F_LAST_POST_AUTHOR = " & rs("MEMBER_ID") & ""
			strSql = strSql & ",    F_LAST_POST_TOPIC_ID = " & NewTopicID
			strSql = strSql & ",    F_LAST_POST_REPLY_ID = " & 0
			strSql = strSql & " WHERE FORUM_ID = " & Forum_ID
			my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
		end if


Apply your INSERT using NewTopicID anywhere after set rs9 = nothing.

However, that recordset was created within an if/end if statement which is if MethodType = "Topic" then/end if.

Either apply your INSERT within that if/end if and somewhere after set rs9 = nothing (During testing, I would try it before the ProcessSubscriptions call since that evokes the inc_mail.asp file, which could possibly lead you down another trail), or apply it after the end if (referring to if MethodType = "Topic" then/end if statement that set rs9 = nothing is in) by using your own if MethodType = "Topic" then/end if statement just before if MethodType = "Reply" or MethodType = "ReplyQuote" or MethodType = "TopicQuote" then.

Again, I would place it above ProcessSubscriptions during testing and then do a Response.Write strSql after the my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords from the INSERT command to verify that the NewTopicID got sent to the custom table.


Cheers,

Etymon
<

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000 Version 3.4.07