Hi, I recently purchased a forum from [url]http://www.webwizguide.com/webwizforums/[/url] I need to modify the SQL slightly as when i click a link to one of my forums within my main forum, I only want that Category forum to show.eg; default.asp?c=1 to only show Category 1 forum<% @ Language=VBScript %><% Option Explicit %><!--#include file="common.asp" --><!--#include file="functions/functions_date_time_format.asp" --><%'Set the response buffer to true as we maybe redirecting and setting a cookieResponse.Buffer = true'Make sure this page is not cachedResponse.Expires = -1Response.ExpiresAbsolute = Now() - 2Response.AddHeader "pragma","no-cache"Response.AddHeader "cache-control","private"Response.CacheControl = "No-Store"'Dimension variablesDim sarryForums 'Holds the recordset array for all the categories and forumsDim saryMemebrStats 'Holds the member statsDim strCategory 'Holds the category nameDim intCatID 'Holds the id for the categoryDim strForumName 'Holds the forum nameDim strForumDiscription 'Holds the forum descriptionDim strForumPassword 'Holds the forum password if there is oneDim lngNumberOfTopics 'Holds the number of topics in a forumDim lngNumberOfPosts 'Holds the number of Posts in the forumDim lngTotalNumberOfTopics 'Holds the total number of topics in a forumDim lngTotalNumberOfPosts 'Holds the total number of Posts in the forumDim intNumberofForums 'Holds the number of forumsDim lngLastEntryMeassgeID 'Holds the message ID of the last entryDim dtmLastEntryDate 'Holds the date of the last entry to the forumDim strLastEntryUser 'Holds the the username of the user who made the last entryDim lngLastEntryUserID 'Holds the ID number of the last user to make and entryDim dtmLastEntryDateAllForums 'Holds the date of the last entry to all fourmsDim strLastEntryUserAllForums 'Holds the the username of the user who made the last entry to all forumsDim lngLastEntryUserIDAllForums 'Holds the ID number of the last user to make and entry to all forumsDim blnForumLocked 'Set to true if the forum is lockedDim intForumColourNumber 'Holds the number to calculate the table row colourDim blnHideForum 'Set to true if this is a hidden forumDim intCatShow 'Holds the ID number of the category to show if only showing one categoryDim intActiveUsers 'Holds the number of active usersDim intActiveGuests 'Holds the number of active guestsDim intActiveMembers 'Holds the number of logged in active membersDim strMembersOnline 'Holds the names of the members onlineDim intSubForumID 'Holds the sub forum ID numberDim strSubForumName 'Holds the sub forum nameDim strSubForums 'Holds if there are sub forumsDim dtmLastSubEntryDate 'Holds the date of the last entry to the forumDim strLastSubEntryUser 'Holds the the username of the user who made the last entryDim lngLastSubEntryUserID 'Holds the ID number of the last user to make and entryDim lngSubForumNumberOfPosts 'Holds the number of posts in the subforumDim lngSubForumNumberOfTopics 'Holds the number of topics in the subforumDim strSubForumPassword 'Holds sub forum passwordDim lngTotalRecords 'Holds the number of recordsDim intCurrentRecord 'Holds the current record positionDim intTempRecord 'Holds a temporary record position for looping through records for any checksDim blnSubRead 'Holds if the user has entry to the sub forumDim lngNoOfMembers 'Holds the number of forum membersDim intArrayPass 'Active users array counterDim strBirthdays 'String containing all those with birtdays todayDim dtmNow 'Now date with off-setDim intBirtdayLoopCounter 'Holds the bitrhday loop counterDim intLastForumEntryID 'Holds the last forum ID for the last entry for link in forum statsDim intTotalViewingForum 'Holds the number of people viewing the forum, including sub forumsDim intAnonymousMembers 'Holds the number of intAnonymous members onlineDim intUnReadPostCount 'Holds the count for the number of unread posts in the forumDim intUnReadForumPostsLoop 'Loop to count the number of unread posts in a forumDim lngTopicID 'Holds the topic IDDim strSubject 'Holds the subjectDim lngSubTopicID 'Holds the topic IDDim strSubSubject 'Holds the subject'Initialise variableslngTotalNumberOfTopics = 0lngTotalNumberOfPosts = 0intNumberofForums = 0intForumColourNumber = 0intActiveMembers = 0intActiveGuests = 0intActiveUsers = 0intAnonymousMembers = 0lngTotalRecords = 0lngNoOfMembers = 0intBirtdayLoopCounter = 0'Test querystrings for any SQL Injection keywordsCall SqlInjectionTest(Request.QueryString())'Read in the category to showIf IsNumeric(Request.QueryString("C")) Then intCatShow = CInt(Request.QueryString("C"))Else intCatShow = 0End If'If we have not yet checked for unread posts since last visit run it nowIf Session("dtmUnReadPostCheck") = "" Then Call UnreadPosts()'Read in array if at application levelElseIf isArray(Application("sarryUnReadPosts" & strSessionID)) Then sarryUnReadPosts = Application("sarryUnReadPosts" & strSessionID)'Read in the unread posts array ElseIf isArray(Session("sarryUnReadPosts")) Then sarryUnReadPosts = Session("sarryUnReadPosts")End If'Read the various categories, forums, and permissions from the database in one hit for extra performance'Initalise the strSQL variable with an SQL statement to query the databasestrSQL = "" & _"SELECT " & strDbTable & "Category.Cat_ID, " & strDbTable & "Category.Cat_name, " & strDbTable & "Forum.Forum_ID, " & strDbTable & "Forum.Sub_ID, " & strDbTable & "Forum.Forum_name, " & strDbTable & "Forum.Forum_description, " & strDbTable & "Forum.No_of_topics, " & strDbTable & "Forum.No_of_posts, " & strDbTable & "Author.Username, " & strDbTable & "Forum.Last_post_author_ID, " & strDbTable & "Forum.Last_post_date, " & strDbTable & "Forum.Password, " & strDbTable & "Forum.Locked, " & strDbTable & "Forum.Hide, " & strDbTable & "Permissions.View_Forum, " & strDbTable & "Forum.Last_topic_ID, " & strDbTable & "Topic.Subject " & _"FROM (((" & strDbTable & "Category INNER JOIN " & strDbTable & "Forum ON " & strDbTable & "Category.Cat_ID = " & strDbTable & "Forum.Cat_ID) LEFT JOIN " & strDbTable & "Topic ON " & strDbTable & "Forum.Last_topic_ID = " & strDbTable & "Topic.Topic_ID) INNER JOIN " & strDbTable & "Author ON " & strDbTable & "Forum.Last_post_author_ID = " & strDbTable & "Author.Author_ID) INNER JOIN " & strDbTable & "Permissions ON " & strDbTable & "Forum.Forum_ID = " & strDbTable & "Permissions.Forum_ID " & _"WHERE (" & strDbTable & "Permissions.Author_ID = " & lngLoggedInUserID & " OR " & strDbTable & "Permissions.Group_ID = " & intGroupID & ") " & _"ORDER BY " & strDbTable & "Category.Cat_order, " & strDbTable & "Forum.Forum_Order, " & strDbTable & "Permissions.Author_ID DESC;"'Set error trappingOn Error Resume Next 'Query the databasersCommon.Open strSQL, adoCon'If an error has occurred write an error to the pageIf Err.Number <> 0 Then Call errorMsg("An error has occurred while executing SQL query on database.", "get_forum_data", "default.asp") 'Disable error trappingOn Error goto 0'Place the recordset into an arrayIf NOT rsCommon.EOF Then sarryForums = rsCommon.GetRows() lngTotalRecords = Ubound(sarryForums,2) + 1End If'Close the recordsetrsCommon.Close'SQL Query Array Look Up table'0 = Cat_ID'1 = Cat_name'2 = Forum_ID'3 = Sub_ID'4 = Forum_name'5 = Forum_description'6 = No_of_topics'7 = No_of_posts'8 = Last_post_author'9 = Last_post_author_ID'10 = Last_post_date'11 = Password'12 = Locked'13 = Hide'14 = Read '15 = Last_topic_ID'16 = Topic.Subject'Get the last signed up user and member stats and birthdays for use at bottom of pageIf blnDisplayBirthdays Then 'Get the now date with time off-set dtmNow = getNowDate() 'Initalise the strSQL variable with an SQL statement to query the database strSQL = "SELECT " & strDbTable & "Author.Username, " & strDbTable & "Author.Author_ID, " & strDbTable & "Author.DOB " & _ "FROM " & strDbTable & "Author" & strDBNoLock & " " & _ "WHERE MONTH(" & strDbTable & "Author.DOB) = " & Month(dtmNow) & " " & _ "AND DAY(" & strDbTable & "Author.DOB) = " & Day(dtmNow) & " " & _ "ORDER BY " & strDbTable & "Author.Author_ID DESC;" 'Set error trapping On Error Resume Next 'Query the database rsCommon.Open strSQL, adoCon 'If an error has occurred write an error to the page If Err.Number <> 0 AND strDatabaseType = "mySQL" Then Call errorMsg("An error has occurred while executing SQL query on database.<br />Please check that the MySQL Server version is 4.1 or above.", "get_birthdays", "default.asp") ElseIf Err.Number <> 0 Then Call errorMsg("An error has occurred while executing SQL query on database.", "get_birthdays", "default.asp") End If 'Disable error trapping On Error goto 0 'Place the recordset into an array If NOT rsCommon.EOF Then 'Read the recordset into an array saryMemebrStats = rsCommon.GetRows() 'Loop through to get all members with birthdays today Do While intBirtdayLoopCounter <= Ubound(saryMemebrStats, 2) 'If bitrhday is found for this date then add it to string If Month(dtmNow) = Month(saryMemebrStats(2, intBirtdayLoopCounter)) AND Day(dtmNow) = Day(saryMemebrStats(2, intBirtdayLoopCounter)) Then 'If there is already one birthday then place a comma before the next If strBirthdays <> "" Then strBirthdays = strBirthdays & ", " 'Place the birthday into the Birthday array strBirthdays = strBirthdays & "<a href=""member_profile.asp?PF=" & saryMemebrStats(1, intBirtdayLoopCounter) & strQsSID2 & """ rel=""nofollow"">" & saryMemebrStats(0, intBirtdayLoopCounter) & "</a> (" & Fix(DateDiff("m", saryMemebrStats(2, intBirtdayLoopCounter), Year(dtmNow) & "-" & Month(dtmNow) & "-" & Day(dtmNow))/12) & ")" End If 'Increment loop counter by 1 intBirtdayLoopCounter = intBirtdayLoopCounter + 1 Loop End If 'Close recordset rsCommon.closeEnd If'Read in some stats about the last membersstrSQL = "SELECT " & strDBTop1 & " " & strDbTable & "Author.Username, " & strDbTable & "Author.Author_ID " If NOT strDatabaseType = "mySQL" Then strSQL = strSQL & ", (SELECT COUNT (*) FROM " & strDbTable & "Author WHERE 1 = 1) AS memberCount "strSQL = strSQL & _"FROM " & strDbTable & "Author" & strDBNoLock & " " & _"ORDER BY " & strDbTable & "Author.Author_ID DESC " & strDBLimit1 & ";"'Set error trappingOn Error Resume Next 'Query the databasersCommon.Open strSQL, adoCon'If an error has occurred write an error to the pageIf Err.Number <> 0 Then Call errorMsg("An error has occurred while executing SQL query on database.", "get_last_USR_+_count", "default.asp") 'Disable error trappingOn Error goto 0'Place the recordset into an arrayIf NOT rsCommon.EOF Then 'Read in member count from database (if NOT mySQL) If NOT strDatabaseType = "mySQL" Then lngNoOfMembers = CLng(rsCommon("memberCount")) 'Read the recordset into an array saryMemebrStats = rsCommon.GetRows()End If'Close recordsetrsCommon.close'We have tgo use a seporate query to count the number of members in mySQLIf strDatabaseType = "mySQL" Then 'Count the number of members strSQL = "SELECT Count(" & strDbTable & "Author.Author_ID) AS memberCount " & _ "FROM " & strDbTable & "Author;" 'Set error trapping On Error Resume Next 'Query the database rsCommon.Open strSQL, adoCon 'If an error has occurred write an error to the page If Err.Number <> 0 Then Call errorMsg("An error has occurred while executing SQL query on database.", "member_count", "default.asp") 'Disable error trapping On Error goto 0 'Read in member count from database lngNoOfMembers = CLng(rsCommon("memberCount")) 'Close recordset rsCommon.closeEnd If'If active users is enabled update the active users application arrayIf blnActiveUsers Then 'Call active users function saryActiveUsers = activeUsers("", strTxtForumIndex, "default.asp", 0)End If'Set the status bar tools'Active Topics LinksstrStatusBarTools = strStatusBarTools & " <img src=""" & strImagePath & "active_topics." & strForumImageType & """ alt=""" & strTxtActiveTopics & """ title=""" & strTxtActiveTopics & """ style=""vertical-align: text-bottom"" /> <a href=""active_topics.asp" & strQsSID1 & """>" & strTxtActiveTopics & "</a> "strStatusBarTools = strStatusBarTools & " <img src=""" & strImagePath & "unanswered_topics." & strForumImageType & """ alt=""" & strTxtUnAnsweredTopics & """ title=""" & strTxtUnAnsweredTopics & """ style=""vertical-align: text-bottom"" /> <a href=""active_topics.asp?UA=Y" & strQsSID2 & """>" & strTxtUnAnsweredTopics & "</a> "'If RSS XML enabled then display an RSS button to link to XML fileIf blnRSS Then strStatusBarTools = strStatusBarTools & " <a href=""RSS_topic_feed.asp" & strQsSID1 & """ target=""_blank""><img src=""" & strImagePath & "rss." & strForumImageType & """ alt=""" & strTxtRSS & ": " & strTxtNewPostFeed & """ title=""" & strTxtRSS & ": " & strTxtNewPostFeed & """ /></a>"%><!-- #include file="includes/browser_page_encoding_inc.asp" --><title><% = strMainForumName %><% If blnLCode Then Response.Write(" - Powered by Web Wiz Forums™") %></title><meta name="generator" content="Web Wiz Forums" /><%'***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******If blnLCode Then Response.Write(vbCrLf & "<meta name=""description"" content=""This is a discussion forum powered by Web Wiz Forums. To find out about Web Wiz Forums, go to http://www.webwizforums.com"" />" & _ vbCrLf & "<meta name=""keywords"" content=""forum, bbs, discussion, bulletin board, message board"" />")End IfResponse.Write(vbCrLf & vbCrLf & "<!--//" & _vbCrLf & "/* *******************************************************" & _vbCrLf & "Software: Web Wiz Forums(TM) ver. " & strVersion & "" & _vbCrLf & "Info: http://www.webwizforums.com" & _vbCrLf & "Copyright: (C)2001-2008 Web Wiz(TM). All rights reserved" & _vbCrLf & "******************************************************* */" & _vbCrLf & "//-->" & vbCrLf)'***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******'If RSS Feed is enabled then have an alt link to the XML file for supporting browsersIf blnRSS Then Response.Write(vbCrLf & "<link rel=""alternate"" type=""application/rss+xml"" title=""RSS 2.0"" href=""RSS_topic_feed.asp" & strQsSID1 & """ />")%>