Author |
Topic |
|
Morpheus73
Average Member
Denmark
597 Posts |
Posted - 05 August 2002 : 05:54:50
|
I´m trying to update the good old Display Content Mod to new version, but there´s something wrong with the SQL syntax in the following code .... can someone please help me? - it´s quite a bit long code, but i suspect the error to be in the section marked with red
select case ContentType case 0 strContentType = "FORUM.CAT_ID" strOperator = " = " case 1 strContentType = "TOPICS.FORUM_ID" strOperator = " = " case 2 strContentType = "TOPICS.TOPIC_ID" strOperator = " = " case 3 strContentType = "TOPICS.T_MSGICON" strOperator = " = " case 4 strContentType = "TOPICS.T_AUTHOR" strOperator = " = " case 5 strContentType = "FORUM.CAT_ID" strOperator = " <> " case 6 strContentType = "TOPICS.FORUM_ID" strOperator = " <> " case 7 strContentType = "TOPICS.TOPIC_ID" strOperator = " <> " case 8 strContentType = "TOPICS.T_MSGICON" strOperator = " <> " case 9 strContentType = "TOPICS.T_AUTHOR" strOperator = " <> " case else ' use Forum ... most likely used strContentType = "TOPICS.FORUM_ID" strOperator = " <> " end select
'## Forum_SQL - First get all required fields from Topics DB strSql = "SELECT " strSql = strSql & strTablePrefix & "CATEGORY.CAT_NAME, " strSql = strSql & strTablePrefix & "CATEGORY.CAT_ORDER, " strSql = strSql & strTablePrefix & "FORUM.F_SUBJECT, " strSql = strSql & strTablePrefix & "FORUM.F_DESCRIPTION, " strSql = strSql & strTablePrefix & "FORUM.CAT_ID, " strSql = strSql & strTablePrefix & "TOPICS.T_STATUS, " strSql = strSql & strTablePrefix & "TOPICS.FORUM_ID, " strSql = strSql & strTablePrefix & "TOPICS.TOPIC_ID, " strSql = strSql & strTablePrefix & "TOPICS.T_SUBJECT, " strSql = strSql & strTablePrefix & "TOPICS.T_MESSAGE, " strSql = strSql & strTablePrefix & "TOPICS.T_VIEW_COUNT, " strSql = strSql & strTablePrefix & "TOPICS.T_LAST_POST, " strSql = strSql & strTablePrefix & "TOPICS.T_DATE, " strSql = strSql & strTablePrefix & "TOPICS.T_REPLIES, " strSql = strSql & strTablePrefix & "TOPICS.T_AUTHOR, " strSql = strSql & strTablePrefix & "TOPICS.T_MSGICON, "
strSql = strSql & strTablePrefix & "MEMBERS.MEMBER_ID, " strSql = strSql & strTablePrefix & "MEMBERS.M_NAME, " strSql = strSql & strTablePrefix & "MEMBERS.M_EMAIL, " strSql = strSql & strTablePrefix & "MEMBERS.M_HOMEPAGE, " strSql = strSql & strTablePrefix & "MEMBERS.M_PHOTO_URL, " strSql = strSql & strTablePrefix & "MEMBERS.M_AVATAR_URL "
strSql = strSql & "FROM " & strTablePrefix & "CATEGORY " strSql = strSql & "INNER JOIN " & strTablePrefix & "FORUM ON " strSql = strSql & strTablePrefix & "CATEGORY.CAT_ID = " strSql = strSql & strTablePrefix & "FORUM.CAT_ID " strSql = strSql & "INNER JOIN " & strTablePrefix & "MEMBERS " strSql = strSql & "INNER JOIN " & strTablePrefix & "TOPICS ON " strSql = strSql & strTablePrefix & "MEMBERS.MEMBER_ID = " strSql = strSql & strTablePrefix & "TOPICS.T_AUTHOR ON " strSql = strSql & strTablePrefix & "FORUM.FORUM_ID = " strSql = strSql & strTablePrefix & "TOPICS.FORUM_ID "
' Then specify WHERE criteria using CONTENTTYPE/CONTENTID to select topics... if ContentID = 0 then strSql = strSql & " WHERE " & strTablePrefix & strContentType & " > " & ContentID ' ALL ID's of a ContentType else strSql = strSql & " WHERE " & strTablePrefix & strContentType & strOperator & ContentID ' A Specific ID of a ContentType or NOT A Specific ID of a ContentType end if
select case TopicStatus ' "Filter" based on Topic Status - Open, closed or both case 0 strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_STATUS = 0" case 1 strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_STATUS = 1" case 2 ' do nothing - select all topics -- indifferent to TopicStatus case else ' do nothing - select all topics -- indifferent to TopicStatus end select
select case DisplayOrder ' Change ASC to DESC if preferred... case 0 ' By Last Posted Date strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_LAST_POST DESC " case 1 ' By Topics Order field (Topic Order mod must be installed) strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_ORDER > 0 " ' Required because NULLs and ZEROs come before 1! strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_ORDER ASC " case 2 ' By most View Counts strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_VIEW_COUNT DESC " case 3 ' By most Replies strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_REPLIES DESC " case 4 ' By msgIcons value (msgIcon mod must be installed) strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_MSGICON ASC " case 5 ' By author strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_AUTHOR ASC " case 6 ' By original post Date strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_DATE ASC " case 7 ' By Forum ID strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.FORUM_ID ASC " case 8 ' By Cat ID strSql = strSql & " ORDER BY " & strTablePrefix & "FORUM.CAT_ID ASC " case 9 ' By Cat Order Field strSql = strSql & " AND " & strTablePrefix & "CATEGORY.CAT_ORDER > 0 " ' Required because NULLs and ZEROs come before 1! strSql = strSql & " ORDER BY " & strTablePrefix & "CATEGORY.CAT_ORDER ASC " case 10 ' By Cat ID & Forum ID strSql = strSql & " ORDER BY " & strTablePrefix & "FORUM.CAT_ID ASC, " strSql = strSql & strTablePrefix & "TOPICS.FORUM_ID ASC " case else ' Use the "default" - By Last Posted Date - DESC strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_LAST_POST DESC " end select
'Response.Write(strSQL) ' Uncomment this line to test 'Response.End ' Uncomment this line to test set rs = Server.CreateObject("ADODB.Recordset") rs.cachesize=20
rs.open strSql, my_Conn, 3
|
|
GauravBhabu
Advanced Member
4288 Posts |
Posted - 05 August 2002 : 07:24:10
|
I remember, I did fix an error in this part of the code.
Try this
select case ContentType case 0 strContentType = "FORUM.CAT_ID" strOperator = " = " case 1 strContentType = "TOPICS.FORUM_ID" strOperator = " = " case 2 strContentType = "TOPICS.TOPIC_ID" strOperator = " = " case 3 strContentType = "TOPICS.T_MSGICON" strOperator = " = " case 4 strContentType = "TOPICS.T_AUTHOR" strOperator = " = " case 5 strContentType = "FORUM.CAT_ID" strOperator = " <> " case 6 strContentType = "TOPICS.FORUM_ID" strOperator = " <> " case 7 strContentType = "TOPICS.TOPIC_ID" strOperator = " <> " case 8 strContentType = "TOPICS.T_MSGICON" strOperator = " <> " case 9 strContentType = "TOPICS.T_AUTHOR" strOperator = " <> " case else ' use Forum ... most likely used strContentType = "TOPICS.FORUM_ID" strOperator = " <> " end select
'## Forum_SQL - First get all required fields from Topics DB strSql = "SELECT " strSql = strSql & strTablePrefix & "CATEGORY.CAT_NAME, " strSql = strSql & strTablePrefix & "CATEGORY.CAT_ORDER, " strSql = strSql & strTablePrefix & "FORUM.F_SUBJECT, " strSql = strSql & strTablePrefix & "FORUM.F_DESCRIPTION, " strSql = strSql & strTablePrefix & "FORUM.CAT_ID, " strSql = strSql & strTablePrefix & "TOPICS.T_STATUS, " strSql = strSql & strTablePrefix & "TOPICS.FORUM_ID, " strSql = strSql & strTablePrefix & "TOPICS.TOPIC_ID, " strSql = strSql & strTablePrefix & "TOPICS.T_SUBJECT, " strSql = strSql & strTablePrefix & "TOPICS.T_MESSAGE, " strSql = strSql & strTablePrefix & "TOPICS.T_VIEW_COUNT, " strSql = strSql & strTablePrefix & "TOPICS.T_LAST_POST, " strSql = strSql & strTablePrefix & "TOPICS.T_DATE, " strSql = strSql & strTablePrefix & "TOPICS.T_REPLIES, " strSql = strSql & strTablePrefix & "TOPICS.T_AUTHOR, " strSql = strSql & strTablePrefix & "TOPICS.T_MSGICON, "
strSql = strSql & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " strSql = strSql & strMemberTablePrefix & "MEMBERS.M_NAME, " strSql = strSql & strMemberTablePrefix & "MEMBERS.M_EMAIL, " strSql = strSql & strMemberTablePrefix & "MEMBERS.M_HOMEPAGE, " strSql = strSql & strMemberTablePrefix & "MEMBERS.M_PHOTO_URL, " strSql = strSql & strMemberTablePrefix & "MEMBERS.M_AVATAR_URL "
'Working Okay strSql = strSql & "FROM " & strMemberTablePrefix & "MEMBERS " strSql = strSql & "INNER JOIN ((" & strTablePrefix & "CATEGORY " strSql = strSql & "INNER JOIN " & strTablePrefix & "FORUM ON " strSql = strSql & strTablePrefix & "CATEGORY.CAT_ID = FORUM_FORUM.CAT_ID) " strSql = strSql & "INNER JOIN " & strTablePrefix & "TOPICS ON " strSql = strSql & strTablePrefix & "FORUM.FORUM_ID = FORUM_TOPICS.FORUM_ID) ON " strSql = strSql & strMemberTablePrefix & "MEMBERS.MEMBER_ID = FORUM_TOPICS.T_AUTHOR " 'Old 'strSql = strSql & "FROM " & strTablePrefix & "CATEGORY " 'strSql = strSql & "INNER JOIN " & strTablePrefix & "FORUM ON " 'strSql = strSql & strTablePrefix & "CATEGORY.CAT_ID = " 'strSql = strSql & strTablePrefix & "FORUM.CAT_ID) " 'strSql = strSql & "INNER JOIN " & strTablePrefix & "MEMBERS " 'strSql = strSql & "INNER JOIN " & strTablePrefix & "TOPICS ON " 'strSql = strSql & strTablePrefix & "MEMBERS.MEMBER_ID = " 'strSql = strSql & strTablePrefix & "TOPICS.T_AUTHOR ON " 'strSql = strSql & strTablePrefix & "FORUM.FORUM_ID = " 'strSql = strSql & strTablePrefix & "TOPICS.FORUM_ID) "
' Then specify WHERE criteria using CONTENTTYPE/CONTENTID to select topics... if ContentID = 0 then strSql = strSql & " WHERE " & strTablePrefix & strContentType & " > " & ContentID ' ALL ID's of a ContentType else strSql = strSql & " WHERE " & strTablePrefix & strContentType & strOperator & ContentID ' A Specific ID of a ContentType or NOT A Specific ID of a ContentType end if
select case TopicStatus ' "Filter" based on Topic Status - Open, closed or both case 0 strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_STATUS = 0" case 1 strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_STATUS = 1" case 2 ' do nothing - select all topics -- indifferent to TopicStatus case else ' do nothing - select all topics -- indifferent to TopicStatus end select
select case DisplayOrder ' Change ASC to DESC if preferred... case 0 ' By Last Posted Date strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_LAST_POST DESC " case 1 ' By Topics Order field (Topic Order mod must be installed) strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_ORDER > 0 " ' Required because NULLs and ZEROs come before 1! strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_ORDER ASC " case 2 ' By most View Counts strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_VIEW_COUNT DESC " case 3 ' By most Replies strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_REPLIES DESC " case 4 ' By msgIcons value (msgIcon mod must be installed) strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_MSGICON ASC " case 5 ' By author strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_AUTHOR ASC " case 6 ' By original post Date strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_DATE ASC " case 7 ' By Forum ID strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.FORUM_ID ASC " case 8 ' By Cat ID strSql = strSql & " ORDER BY " & strTablePrefix & "FORUM.CAT_ID ASC " case 9 ' By Cat Order Field strSql = strSql & " AND " & strTablePrefix & "CATEGORY.CAT_ORDER > 0 " ' Required because NULLs and ZEROs come before 1! strSql = strSql & " ORDER BY " & strTablePrefix & "CATEGORY.CAT_ORDER ASC " case 10 ' By Cat ID & Forum ID strSql = strSql & " ORDER BY " & strTablePrefix & "FORUM.CAT_ID ASC, " strSql = strSql & strTablePrefix & "TOPICS.FORUM_ID ASC " case else ' Use the "default" - By Last Posted Date - DESC strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_LAST_POST DESC " end select
'Response.Write(strSQL) ' Uncomment this line to test 'Response.End ' Uncomment this line to test set rs = Server.CreateObject("ADODB.Recordset") rs.cachesize=20
rs.open strSql, my_Conn, 3
www.forumSquare.com - Rakesh Jain - It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying. |
|
|
GauravBhabu
Advanced Member
4288 Posts |
Posted - 05 August 2002 : 07:27:51
|
The error you might be getting is indeed in the red part you mentioned. I replaced that part of the code as you can see in the code posted by me above.
www.forumSquare.com - Rakesh Jain - It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying. |
|
|
Pouyan
New Member
91 Posts |
Posted - 05 August 2002 : 18:14:45
|
quote: I´m trying to update the good old Display Content Mod to new version
WOW ! Are you also going to add more features to it ? I can't waitttt...
Edited by - Pouyan on 05 August 2002 18:16:37 |
|
|
Etymon
Advanced Member
United States
2385 Posts |
Posted - 05 August 2002 : 18:20:27
|
Is this the only error anyone has found this mod? When I start the next chapter of my forum, I want this MOD to do the work. The one at the MOD creator's forum looks just so awesome!!
How do the other MODs like the Slash MOD and the Syndication MOD compare?
Thanks again for discussing this topic. I really needed it! I hope it helps others as well.
Cheers,
Etymon
Are you looking for answers at Snitz? | Searching the forums is easiest! Basic | Advanced (Internet Explorer only) |
|
|
|
Topic |
|
|
|