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)
 Author's Last 3 Topics In Topic.asp

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
ILLHILL Posted - 23 February 2006 : 16:32:48
I'm trying on getting the last 3 topics to show up as links
in a person's post. So when an author writes something interesting
the reader can click on the last 3 topics started by this author.

However, the links show up but also contain the author's replies
instead of only his started topics.

I know it has to do with the Join part in here:

'## Forum_SQL - Find all records for the member
strsql = "SELECT F.FORUM_ID"
strSql = strSql & ", T.TOPIC_ID"
strSql = strSql & ", T.T_DATE"
strSql = strSql & ", T.T_SUBJECT"
strSql = strSql & ", T.T_MESSAGE"
strSql = strSql & ", T.T_STATUS"
strSql = strSql & ", T.T_LAST_POST"
strSql = strSql & " FROM ((" & strTablePrefix & "FORUM F LEFT JOIN " & strTablePrefix & "TOPICS T"
strSql = strSql & " ON F.FORUM_ID = T.FORUM_ID) LEFT JOIN " & strTablePrefix & "REPLY R"
strSql = strSql & " ON T.TOPIC_ID = R.TOPIC_ID) "
strSql = strSql & " WHERE (T_DATE > '" & strStartDate & "') "
strSql = strSql & " AND (T.T_AUTHOR = " & TMember_ID
strSql = strSql & " OR R.R_AUTHOR = " & TMember_ID & ")"
strSql = strSql & " AND (T_STATUS < 2 OR T_STATUS = 0)"
strSql = strSql & " AND F.F_TYPE = 0"
strSql = strSql & " ORDER BY T.TOPIC_ID DESC"

Everytime I experiment with the Left Join part it bugs out on me.
Can anybody show me the way?

Thanks in advance, Dominic
<
8   L A T E S T    R E P L I E S    (Newest First)
ILLHILL Posted - 27 February 2006 : 14:16:47
Nevermind, solved it:

strSql = "SELECT TOP 3 T.TOPIC_ID, T.T_SUBJECT FROM " & strTablePrefix & "TOPICS T WHERE T.T_AUTHOR = " & TMember_ID & " ORDER BY T.TOPIC_ID DESC"
set rs2 = my_Conn.Execute(strsql)

Thanks so much!

Greets, Dominic
<
ILLHILL Posted - 27 February 2006 : 14:07:52
It gives an error when I try it:

ADODB.Recordset error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

Shouldn't the T.T_SUBJECT be included in the string somewhere?<
Etymon Posted - 27 February 2006 : 06:22:10
If your Record Set is called rs, then after you open it use

rs("T_SUBJECT")

where ever you need it or declare it, as in

Topic_Subject = rs("T_SUBJECT")

and then use

Topic_Subject

where ever you may need it. <
ILLHILL Posted - 26 February 2006 : 13:47:59
Got it to work! Thanks so much!
One last thing. Where do I add the T.T_SUBJECT part, so I can display the topic titles as
links?

Greets & thanks again!

Dominic<
Etymon Posted - 26 February 2006 : 00:04:09
In your SELECT statement, you'll have to add the term TOP 3 so the query will select the top (or first) 3 in the order you specify (either ascending or descending).

It needs to looks something like this:

strSql = "SELECT TOP 3 TOPIC_ID FROM " & strTablePrefix & "TOPICS WHERE T_AUTHOR = " & TMember_ID & " ORDER BY TOPIC_ID DESC"

or

strSql = "SELECT TOP 3 T.TOPIC_ID FROM " & strTablePrefix & "TOPICS T WHERE T.T_AUTHOR = " & TMember_ID & " ORDER BY T.TOPIC_ID DESC"

This query is assuming that you are seeking the first three most recent topic id's created by the author id carried in TMember_ID.<
ILLHILL Posted - 24 February 2006 : 20:56:20
I tried this:

'## Forum_SQL - Find all records for the member
strsql = "SELECT F.FORUM_ID"
strSql = strSql & ", T.TOPIC_ID"
strSql = strSql & ", T.T_DATE"
strSql = strSql & ", T.T_SUBJECT"
strSql = strSql & ", T.T_STATUS"
strSql = strSql & ", T.T_LAST_POST"
strSql = strSql & " FROM " & strTablePrefix & "TOPICS T"
strSql = strSql & " WHERE T_DATE > " & strStartDate
strSql = strSql & " AND T.T_AUTHOR = " & TMember_ID
strSql = strSql & " AND T_STATUS < " & 2
strSql = strSql & " ORDER BY T.TOPIC_ID DESC"

But no luck.

Anybody knows how to do this?

Thanks, D<
ILLHILL Posted - 23 February 2006 : 20:06:53
Any idea how I would do this? The moment I start messing with it it results in:
Syntax error in JOIN operation

<
AnonJr Posted - 23 February 2006 : 17:03:39
If I'm remembering right, the initial post is in the topics table and all replies are in the reply table... if that's right then I'd think you wouldn't need the reply table in the query to show just the topics they started....

But I'd get some confirmation on that first part before I took my word for it... I'm not exactly working at 100% today.<

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