Originally posted by ruiribThat's the way I would go too.
Thanks table, with topic_ID, member_ID, date thanked. Thanks count, different topics count, added to the member's table (which is very big too, anyway, but two integer fields are not a big source of trouble.
Originally posted by ruirib Thanks table, with topic_ID, member_ID, date thanked. Thanks count, different topics count....What would you use the two member table fields for? Wouldn't a query against the thanks/topic/member table give you any of the values or totals?
Is it possible to gets a 'thanks' button? Many times posters leave useful or insightful posts but I don't wish to clutter the topic threads by just saying thanks, I'm sure others also do feel this way too, but I'd like the poster to know that his/her post was appreciated as well as read.
Originally posted by CarefreeI've got a project or two like that myself.
I'll finish it sooner or later. I suppose I should try and concentrate on it more. Don't know what it is about this one, I work on it a few minutes and do almost anything else to get away.
Thanks 1.0
[CREATE]
THANKS
TOPIC_ID#INT##0
REPLY_ID#INT##0
MEMBER_ID#INT##0
[END]
Look for the following line (appx 148):
Const strIconZap = "icon_zap.gif|16|16"
Below it, insert this:
Const strIconThanks = "icon_thanks.png|23|22"
Look for the following lines (appx 842-844):
Response.Write " <hr noshade size=""" & strFooterFontSize & """></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
Above those, insert these:
' ## Thanks Below
intCnt = 0 : intTY = 0
strSqlTY = "SELECT * FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Request("TOPIC_ID") & " AND MEMBER_ID=" & MemberID & " AND REPLY_ID = 0"
Set rsTY=my_Conn.Execute(strSqlTY)
If (rsTY.BOF Or rsTY.EOF) And (TMember_ID <> MemberID) And (mLev > 0) Then
If (Request("Thanks") > "") And (Request("REPLY_ID")<1) Then
my_Conn.Execute("INSERT INTO " & strTablePrefix & "THANKS (MEMBER_ID, TOPIC_ID) VALUES (" & MemberID & ", " & ChkString(Request("TOPIC_ID"), "SQLString") & ")")
End If
Else
intTY=1
rsTY.Close
End If
Set rsTY = Nothing
strSqlTY = "SELECT COUNT(MEMBER_ID) AS CNT FROM " & strTablePrefix & "THANKS WHERE REPLY_ID=0 AND TOPIC_ID=" & TOPIC_ID
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
intCnt = rsTY("CNT")
rsTY.Close
End If
Set rsTY = Nothing
If (TMember_ID <> MemberID) And (intTY = 0) And (mLev > 0) Then
Response.Write " <a href=""topic.asp?Thanks=" & MemberID & "&method=" & Request("method") & "&TOPIC_ID=" & Topic_ID & "&FORUM_ID=" & Forum_ID & """>" & getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "</a> <font color=""" & strHiLiteFontColor & """>" & intCnt & "</font>" & vbNewLine
Else
Response.Write getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "<font color=""" & strHiLiteFontColor & """>" & intCnt & "</font>" & vbNewLine
End If
' ## Thanks Above
Next, look for the following lines (appx 641-643):
Response.Write " <hr noshade size=""" & strFooterFontSize & """></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
Above those, insert these:
' ## Thanks Below
intCnt = 0 : intTY = 0
strSqlTY = "SELECT * FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Reply_TopicID & " AND MEMBER_ID=" & MemberID & " AND REPLY_ID=" & Reply_ReplyID
Set rsTY=my_Conn.Execute(strSqlTY)
If (rsTY.BOF Or rsTY.EOF) And (Reply_MemberID <> MemberID) And (mLev > 0) Then
If Request("Thanks") > "" Then
my_Conn.Execute("INSERT INTO " & strTablePrefix & "THANKS (MEMBER_ID, TOPIC_ID, REPLY_ID) VALUES (" & MemberID & ", " & ChkString(Request("TOPIC_ID"), "SQLString") & ", " & ChkString(Request("REPLY_ID"), "SQLString") & ")")
End If
Else
intTY = 1
rsTY.Close
End If
Set rsTY = Nothing
strSqlTY = "SELECT COUNT(MEMBER_ID) AS CNT FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Reply_TopicID & " AND REPLY_ID=" & Reply_ReplyID
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
intCnt = rsTY("CNT")
rsTY.Close
End If
Set rsTY = Nothing
If (Reply_MemberID <> MemberID) And (intTY = 0) And (mLev > 0) Then
Response.Write " <a href=""topic.asp?Thanks=" & MemberID & "&method=" & Request("method") & "&REPLY_ID=" & Reply_ReplyID & "&TOPIC_ID=" & Reply_TopicID & "&FORUM_ID=" & Forum_ID & """>" & getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "</a> <font color=""" & strHiLiteFontColor & """>" & intCnt & "</font>" & vbNewLine
Else
Response.Write getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "<font color=""" & strHiLiteFontColor & """>" & intCnt & "</font>" & vbNewLine
End If
' ## Thanks Above
Look for the following lines (appx 842-844):
Response.Write " <hr noshade size=""" & strFooterFontSize & """></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
Above those, insert these:
' ## Thanks Below
intCnt = 0 : intTY = 0
strSqlTY = "SELECT * FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Request("TOPIC_ID") & " AND MEMBER_ID=" & MemberID & " AND REPLY_ID = 0"
Set rsTY=my_Conn.Execute(strSqlTY)
If (rsTY.BOF Or rsTY.EOF) And (TMember_ID <> MemberID) And (mLev > 0) Then
If (Request("Thanks") > "") And (Request("REPLY_ID")<1) Then
my_Conn.Execute("INSERT INTO " & strTablePrefix & "THANKS (MEMBER_ID, TOPIC_ID) VALUES (" & MemberID & ", " & ChkString(Request("TOPIC_ID"), "SQLString") & ")")
End If
Else
intTY=1
rsTY.Close
End If
Set rsTY = Nothing
strSqlTY = "SELECT COUNT(MEMBER_ID) AS CNT FROM " & strTablePrefix & "THANKS WHERE REPLY_ID=0 AND TOPIC_ID=" & TOPIC_ID
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
intCnt = rsTY("CNT")
rsTY.Close
End If
Set rsTY = Nothing
If (TMember_ID <> MemberID) And (intTY = 0) And (mLev > 0) Then
Response.Write " <a href=""topic.asp?Thanks=" & MemberID & "&method=" & Request("method") & "&TOPIC_ID=" & Topic_ID & "&FORUM_ID=" & Forum_ID & """>" & getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "</a> <font color=""" & strHiLiteFontColor & """><a style=""text-decoration:none;"" href=""JavaScript:openWindowThanks('pop_thanks.asp?TID=" & Topic_ID & "&RID=0')"">" & intCnt & "</a></font>" & vbNewLine
Else
Response.Write getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "<font color=""" & strHiLiteFontColor & """><a style=""text-decoration:none;"" href=""JavaScript:openWindowThanks('pop_thanks.asp?TID=" & Topic_ID & "&RID=0')"">" & intCnt & "</a></font>" & vbNewLine
End If
' ## Thanks Above
Next, look for the following lines (appx 641-643):
Response.Write " <hr noshade size=""" & strFooterFontSize & """></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
Above those, insert these:
' ## Thanks Below
intCnt = 0 : intTY = 0
strSqlTY = "SELECT * FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Reply_TopicID & " AND MEMBER_ID=" & MemberID & " AND REPLY_ID=" & Reply_ReplyID
Set rsTY=my_Conn.Execute(strSqlTY)
If (rsTY.BOF Or rsTY.EOF) And (Reply_MemberID <> MemberID) And (mLev > 0) Then
If Request("Thanks") > "" Then
my_Conn.Execute("INSERT INTO " & strTablePrefix & "THANKS (MEMBER_ID, TOPIC_ID, REPLY_ID) VALUES (" & MemberID & ", " & ChkString(Request("TOPIC_ID"), "SQLString") & ", " & ChkString(Request("REPLY_ID"), "SQLString") & ")")
End If
Else
intTY = 1
rsTY.Close
End If
Set rsTY = Nothing
strSqlTY = "SELECT COUNT(MEMBER_ID) AS CNT FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Reply_TopicID & " AND REPLY_ID=" & Reply_ReplyID
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
intCnt = rsTY("CNT")
rsTY.Close
End If
Set rsTY = Nothing
If (Reply_MemberID <> MemberID) And (intTY = 0) And (mLev > 0) Then
Response.Write " <a href=""topic.asp?Thanks=" & MemberID & "&method=" & Request("method") & "&REPLY_ID=" & Reply_ReplyID & "&TOPIC_ID=" & Reply_TopicID & "&FORUM_ID=" & Forum_ID & """>" & getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "</a> <font color=""" & strHiLiteFontColor & """><a style=""text-decoration:none;"" href=""JavaScript:openWindowThanks('pop_thanks.asp?TID=" & Reply_TopicID & "&RID=" & Reply_ReplyID & "')"">" & intCnt & "</a></font>" & vbNewLine
Else
Response.Write getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "<font color=""" & strHiLiteFontColor & """><a style=""text-decoration:none;"" href=""JavaScript:openWindowThanks('pop_thanks.asp?TID=" & Reply_TopicID & "&RID=" & Reply_ReplyID & "')"">" & intCnt & "</a></font>" & vbNewLine
End If
' ## Thanks Above
Look for the following lines (appx 256-258):
"function openWindowHelp(url) {" & vbNewLine & _
" popupWin = window.open(url,'new_page','width=470,height=200,scrollbars=yes')" & vbNewLine & _
"}" & vbNewLine & _
Below those, insert these:
"function openWindowThanks(url) {" & vbNewLine & _
" popupWin = window.open(url,'new_page','width=800,height=600,scrollbars=yes,resizable=yes')" & vbNewLine & _
"}" & vbNewLine & _
<!--#INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="inc_header_short.asp" -->
<%
' ## Set value for intTYReaders below.
' 0 = Author only
' 1 = Author, Admins
' 2 = Author, Admins, Moderators
' 3 = All members
' 4 = Anyone
intTYReaders = 0 : intTYAllowed=0
If Request("RID") > "0" Then
strSqlTY = "SELECT R_AUTHOR FROM " & strTablePrefix & "REPLY WHERE REPLY_ID=" & Request("RID")
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
intRID=rsTY("R_AUTHOR")
rsTY.Close
End If
Set rsTY = Nothing
Select Case intTYReaders
Case 0
If (MemberID = intRID) Then
Call TY_Replies
End If
Case 1
If (MemberID = intRID) Or (mLev > 2) Then
Call TY_Replies
End If
Case 2
If (MemberID = intRID) Or (mLev > 1) Then
Call TY_Replies
End If
Case 3
If (MemberID = intRID) Or (mLev > 0) Then
Call TY_Replies
End If
Case Else
Call TY_Replies
End Select
End If
If Request("RID") = "0" Then
strSqlTY = "SELECT T_AUTHOR FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID=" & Request("TID") & " AND REPLY_ID=0)
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
intTID=rsTY("T_AUTHOR")
rsTY.Close
End If
Set rsTY = Nothing
Select Case intTYReaders
Case 0
If (MemberID = intTID) Then
Call TY_Topics
End If
Case 1
If (MemberID = intTID) Or (mLev > 2) Then
Call TY_Topics
End If
Case 2
If (MemberID = intTID) Or (mLev > 1) Then
Call TY_Topics
End If
Case 3
If (MemberID = intTID) Or (mLev > 0) Then
Call TY_Topics
End If
Case Else
Call TY_Topics
End Select
End If
Sub TY_Replies
strSqlTY = "SELECT * FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Request("TID") & " AND REPLY_ID=" & Request("RID")
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
rsTY.MoveFirst
Do While Not rsTY.EOF
strSqlTYM = "SELECT M_NAME FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID = " & rsTY("MEMBER_ID")
Set rsTYM=my_Conn.Execute(strSqlTYM)
If Not rsTYM.EOF Then
Response.Write rsTYM("M_NAME")
rsTYM.Close
End If
Set rsTYM = Nothing
rsTY.MoveNext
If Not rsTY.EOF Then Response.Write ", "
Loop
rsTY.Close
End If
Set rsTY=Nothing
intTYAllowed=1
End Sub
Sub TY_Topics
strSqlTY = "SELECT * FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Request("TID")
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
rsTY.MoveFirst
Do While Not rsTY.EOF
strSqlTYM = "SELECT M_NAME FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID = " & rsTY("MEMBER_ID")
Set rsTYM=my_Conn.Execute(strSqlTYM)
If Not rsTYM.EOF Then
Response.Write rsTYM("M_NAME")
rsTYM.Close
End If
Set rsTYM = Nothing
rsTY.MoveNext
If Not rsTY.EOF Then Response.Write ", "
Loop
rsTY.Close
End If
Set rsTY=Nothing
intTYAllowed=1
End Sub
If intTYAllowed = 0 Then Response.Write "Not authorized to view names.<br />"
WriteFooterShort
%>
Code:
Look for the following line (appx 148):
Const strIconZap = "icon_zap.gif|16|16"
Below it, insert this:
Const strIconThanks = "icon_thanks.png|16|16"
Code:
Look for the following lines (appx 842-844):
Response.Write " <hr noshade size=""" & strFooterFontSize & """></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
Above those, insert these:
' ## Thanks Below
intCnt = 0 : intTY = 0
strSqlTY = "SELECT * FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Request("TOPIC_ID") & " AND MEMBER_ID=" & MemberID & " AND REPLY_ID = 0"
Set rsTY=my_Conn.Execute(strSqlTY)
If (rsTY.BOF Or rsTY.EOF) And TMember_ID <> MemberID Then
If Request("Thanks") > "" Then
my_Conn.Execute("INSERT INTO " & strTablePrefix & "THANKS (MEMBER_ID, TOPIC_ID) VALUES (" & MemberID & ", " & ChkString(Request("TOPIC_ID"), "SQLString") & ")")
End If
Else
intTY=1
rsTY.Close
End If
Set rsTY = Nothing
strSqlTY = "SELECT COUNT(MEMBER_ID) AS CNT FROM " & strTablePrefix & "THANKS WHERE REPLY_ID=0 AND TOPIC_ID=" & TOPIC_ID
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
intCnt = rsTY("CNT")
rsTY.Close
End If
Set rsTY = Nothing
If (TMember_ID <> MemberID) And (intTY = 0) Then
if mlev > 0 then
Response.Write " <a href=""topic.asp?Thanks=" & MemberID & "&method=" & Request("method") & "&TOPIC_ID=" & Topic_ID & "&FORUM_ID=" & Forum_ID & """>" & getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "</a> <font color=""" & strHiLiteFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>(" & intCnt & ")</font>" & vbNewLine
else
Response.Write getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "<font color=""" & strHiLiteFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>(" & intCnt & ")</font>" & vbNewLine
end if
Else
Response.Write getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "<font color=""" & strHiLiteFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>(" & intCnt & ")</font>" & vbNewLine
End If
' ## Thanks Above
Next, look for the following lines (appx 641-643):
Response.Write " <hr noshade size=""" & strFooterFontSize & """></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
Above those, insert these:
' ## Thanks Below
intCnt = 0 : intTY = 0
strSqlTY = "SELECT * FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Reply_TopicID & " AND MEMBER_ID=" & MemberID & " AND REPLY_ID=" & Reply_ReplyID
Set rsTY=my_Conn.Execute(strSqlTY)
If (rsTY.BOF Or rsTY.EOF) And (Reply_MemberID <> MemberID) Then
If Request("Thanks") > "" Then
my_Conn.Execute("INSERT INTO " & strTablePrefix & "THANKS (MEMBER_ID, TOPIC_ID, REPLY_ID) VALUES (" & MemberID & ", " & ChkString(Request("TOPIC_ID"), "SQLString") & ", " & ChkString(Request("REPLY_ID"), "SQLString") & ")")
End If
Else
intTY = 1
rsTY.Close
End If
Set rsTY = Nothing
strSqlTY = "SELECT COUNT(MEMBER_ID) AS CNT FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Reply_TopicID & " AND REPLY_ID=" & Reply_ReplyID
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
intCnt = rsTY("CNT")
rsTY.Close
End If
Set rsTY = Nothing
If (Reply_MemberID <> MemberID) And (intTY = 0) Then
if mlev > 0 then
Response.Write " <a href=""topic.asp?Thanks=" & MemberID & "&method=" & Request("method") & "&REPLY_ID=" & Reply_ReplyID & "&TOPIC_ID=" & Reply_TopicID & "&FORUM_ID=" & Forum_ID & """>" & getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "</a> <font color=""" & strHiLiteFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>(" & intCnt & ")</font>" & vbNewLine
else
Response.Write getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "<font color=""" & strHiLiteFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>(" & intCnt & ")</font>" & vbNewLine
end if
Else
Response.Write getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "<font color=""" & strHiLiteFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>(" & intCnt & ")</font>" & vbNewLine
End If
' ## Thanks Above
Creating table(s)... CREATE TABLE FORUM_THANKS( THANKS_ID INT (11) DEFAULT '' NOT NULL auto_increment , TOPIC_ID int NOT NULL DEFAULT 0, REPLY_ID int NOT NULL DEFAULT 0, MEMBER_ID int NOT NULL DEFAULT 0,KEY FORUM_THANKS_THANKS_ID(THANKS_ID))
CREATE TABLE FORUM_THANKS( THANKS_ID INT (11) DEFAULT '' NOT NULL auto_increment , TOPIC_ID int NOT NULL DEFAULT 0, REPLY_ID int NOT NULL DEFAULT 0, MEMBER_ID int NOT NULL DEFAULT 0,KEY FORUM_THANKS_THANKS_ID(THANKS_ID))
-2147467259 | [MySQL][ODBC 5.1 Driver][mysqld-5.1.73-community]Invalid default value for 'THANKS_ID'
Microsoft OLE DB Provider for ODBC Drivers error '80040e37'
[MySQL][ODBC 5.1 Driver][mysqld-5.1.73-community]Table 'database_name.reply' doesn't exist
/forum/pop_thanks.asp, line 14
Also when clicking to see who has 'thanked' the pop up returns the following error..That's because you never configured your strActivePrefix in config.asp ... a lot of the code uses that and you're going to run into errors until you add it. But for the purpose of this, I'll change it to strTablePrefix and the error will go away.
Microsoft OLE DB Provider for ODBC Drivers error '80040e37'
[MySQL][ODBC 5.1 Driver][mysqld-5.1.73-community]Table 'database_name.reply' doesn't exist
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[MySQL][ODBC 5.1 Driver][mysqld-5.1.73-community]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
/forum/topic.asp, line 946
' ## Thanks Below
intCnt = 0 : intTY = 0
strSqlTY = "SELECT * FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Reply_TopicID & " AND MEMBER_ID=" & MemberID & " AND REPLY_ID=" & Reply_ReplyID
Set rsTY=my_Conn.Execute(strSqlTY)
If (rsTY.BOF Or rsTY.EOF) And (Reply_MemberID <> MemberID) And (mLev > 0) Then
If Request("Thanks") > "" Then
intTID=ChkString(Request("TOPIC_ID"), "SQLString")
intRID=ChkString(Request("REPLY_ID"), "SQLString")
strSqlTY = "INSERT INTO " & strTablePrefix & "THANKS (MEMBER_ID, TOPIC_ID, REPLY_ID) VALUES (" & MemberID & ", " & intTID & ", " & intRID & ")"
my_Conn.Execute(strSqlTY)
End If
Else
intTY = 1
rsTY.Close
End If
Set rsTY = Nothing
strSqlTY = "SELECT COUNT(MEMBER_ID) AS CNT FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Reply_TopicID & " AND REPLY_ID=" & Reply_ReplyID
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
intCnt = rsTY("CNT")
rsTY.Close
End If
Set rsTY = Nothing
If (Reply_MemberID <> MemberID) And (intTY = 0) And (mLev > 0) Then
Response.Write " <a href=""topic.asp?Thanks=" & MemberID & "&method=" & Request("method") & "&REPLY_ID=" & Reply_ReplyID & "&TOPIC_ID=" & Reply_TopicID & "&FORUM_ID=" & Forum_ID & """>" & getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "</a> <font color=""" & strHiLiteFontColor & """><a style=""text-decoration:none;"" href=""JavaScript:openWindowThanks('pop_thanks.asp?TID=" & Reply_TopicID & "&RID=" & Reply_ReplyID & "')"">" & intCnt & "</a></font>" & vbNewLine
Else
Response.Write getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "<font color=""" & strHiLiteFontColor & """><a style=""text-decoration:none;"" href=""JavaScript:openWindowThanks('pop_thanks.asp?TID=" & Reply_TopicID & "&RID=" & Reply_ReplyID & "')"">" & intCnt & "</a></font>" & vbNewLine
End If
' ## Thanks Above
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[MySQL][ODBC 5.1 Driver][mysqld-5.1.73-community]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
/forum/topic.asp, line 948
' ## Thanks Below
intCnt = 0 : intTY = 0
strSqlTY = "SELECT * FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Reply_TopicID & " AND MEMBER_ID=" & MemberID & " AND REPLY_ID=" & Reply_ReplyID
Set rsTY=my_Conn.Execute(strSqlTY)
If (rsTY.BOF Or rsTY.EOF) And (Reply_MemberID <> MemberID) And (mLev > 0) Then
If Request("Thanks") > "" Then
my_Conn.Execute("INSERT INTO " & strTablePrefix & "THANKS (MEMBER_ID, TOPIC_ID, REPLY_ID) VALUES (" & MemberID & ", " & ChkString(Request("TOPIC_ID"), "SQLString") & ", " & ChkString(Request("REPLY_ID"), "SQLString") & ")")
End If
Else
intTY = 1
rsTY.Close
End If
Set rsTY = Nothing
strSqlTY = "SELECT COUNT(MEMBER_ID) AS CNT FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Reply_TopicID & " AND REPLY_ID=" & Reply_ReplyID
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
intCnt = rsTY("CNT")
rsTY.Close
End If
Set rsTY = Nothing
If (Reply_MemberID <> MemberID) And (intTY = 0) And (mLev > 0) Then
Response.Write " <a href=""topic.asp?Thanks=" & MemberID & "&method=" & Request("method") & "&REPLY_ID=" & Reply_ReplyID & "&TOPIC_ID=" & Reply_TopicID & "&FORUM_ID=" & Forum_ID & """>" & getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "</a> <font color=""" & strHiLiteFontColor & """><a style=""text-decoration:none;"" href=""JavaScript:openWindowThanks('pop_thanks.asp?TID=" & Reply_TopicID & "&RID=" & Reply_ReplyID & "')"">" & intCnt & "</a></font>" & vbNewLine
Else
Response.Write getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "<font color=""" & strHiLiteFontColor & """><a style=""text-decoration:none;"" href=""JavaScript:openWindowThanks('pop_thanks.asp?TID=" & Reply_TopicID & "&RID=" & Reply_ReplyID & "')"">" & intCnt & "</a></font>" & vbNewLine
End If
' ## Thanks Above
' ## Thanks Below
intCnt = 0 : intTY = 0
strSqlTY = "SELECT * FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Request("TOPIC_ID") & " AND MEMBER_ID=" & MemberID & " AND REPLY_ID = 0"
Set rsTY=my_Conn.Execute(strSqlTY)
If (rsTY.BOF Or rsTY.EOF) And (TMember_ID <> MemberID) And (mLev > 0) Then
If (Request("Thanks") > "") And (Request("REPLY_ID")<1) Then
my_Conn.Execute("INSERT INTO " & strTablePrefix & "THANKS (MEMBER_ID, TOPIC_ID) VALUES (" & MemberID & ", " & ChkString(Request("TOPIC_ID"), "SQLString") & ")")
End If
Else
intTY=1
rsTY.Close
End If
Set rsTY = Nothing
strSqlTY = "SELECT COUNT(MEMBER_ID) AS CNT FROM " & strTablePrefix & "THANKS WHERE REPLY_ID=0 AND TOPIC_ID=" & TOPIC_ID
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
intCnt = rsTY("CNT")
rsTY.Close
End If
Set rsTY = Nothing
If (TMember_ID <> MemberID) And (intTY = 0) And (mLev > 0) Then
Response.Write " <a href=""topic.asp?Thanks=" & MemberID & "&method=" & Request("method") & "&TOPIC_ID=" & Topic_ID & "&FORUM_ID=" & Forum_ID & """>" & getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "</a> <font color=""" & strHiLiteFontColor & """><a style=""text-decoration:none;"" href=""JavaScript:openWindowThanks('pop_thanks.asp?TID=" & Topic_ID & "&RID=0')"">" & intCnt & "</a></font>" & vbNewLine
Else
Response.Write getCurrentIcon(strIconThanks,"Thanks","align=""absmiddle"" hspace=""6""") & "<font color=""" & strHiLiteFontColor & """><a style=""text-decoration:none;"" href=""JavaScript:openWindowThanks('pop_thanks.asp?TID=" & Topic_ID & "&RID=0')"">" & intCnt & "</a></font>" & vbNewLine
End If
' ## Thanks Above
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[MySQL][ODBC 5.1 Driver][mysqld-5.1.73-community]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
/forum/topic.asp, line 945
For i = 1 to 4
or
Do while
or
Do until
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[MySQL][ODBC 5.1 Driver][mysqld-5.1.73-community]Duplicate entry '180108' for key 'PRIMARY'
/forum/topic.asp, line 946
<!--#INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="inc_header_short.asp" -->
<%
' ## Set value for intReaders below.
' 0 = Author only
' 1 = Author, Admins
' 2 = Author, Admins, Moderators
' 3 = All members
' 4 = Anyone
intTYReaders = 1 : intTYAllowed=0
If Request("RID") > "0" Then
strSqlTY = "SELECT R_AUTHOR FROM " & strTablePrefix & "REPLY WHERE REPLY_ID=" & Request("RID")
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
intRID=rsTY("R_AUTHOR")
rsTY.Close
End If
Set rsTY = Nothing
strSqlTY = "SELECT MEMBER_ID FROM (SELECT DISTINCT MEMBER_ID, TOPIC_ID, REPLY_ID FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Request("TID") & " AND REPLY_ID=" & Request("RID") & ") GROUP BY MEMBER_ID, TOPIC_ID, REPLY_ID;"
Select Case intTYReaders
Case 0
If (MemberID = intRID) Then
Call TYP
End If
Case 1
If (MemberID = intRID) Or (mLev > 2) Then
Call TYP
End If
Case 2
If (MemberID = intRID) Or (mLev > 1) Then
Call TYP
End If
Case 3
If (MemberID = intRID) Or (mLev > 0) Then
Call TYP
End If
Case Else
Call TYP
End Select
End If
If Request("RID") = "0" Then
strSqlTY = "SELECT T_AUTHOR FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID=" & Request("TID")
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
intTID=rsTY("T_AUTHOR")
rsTY.Close
End If
Set rsTY = Nothing
strSqlTY = "SELECT MEMBER_ID FROM (SELECT DISTINCT MEMBER_ID, TOPIC_ID, REPLY_ID FROM " & strTablePrefix & "THANKS WHERE TOPIC_ID=" & Request("TID") & " AND REPLY_ID=0) GROUP BY MEMBER_ID, TOPIC_ID, REPLY_ID;"
Select Case intTYReaders
Case 0
If (MemberID = intTID) Then
Call TYP
End If
Case 1
If (MemberID = intTID) Or (mLev > 2) Then
Call TYP
End If
Case 2
If (MemberID = intTID) Or (mLev > 1) Then
Call TYP
End If
Case 3
If (MemberID = intTID) Or (mLev > 0) Then
Call TYP
End If
Case Else
Call TYP
End Select
End If
Sub TYP
Set rsTY=my_Conn.Execute(strSqlTY)
If Not rsTY.EOF Then
Response.Write "<table align=""0"" border=""0"" cellpadding=""4"" cellspacing=""0"" bgColor=""" & strPageBGColor & """>" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine
rsTY.MoveFirst
intAvatDis=0
Do While Not rsTY.EOF
intAvatDis = intAvatDis + 1
If intAvatDis=5 Then
intAvatDis = 0
Response.Write "</tr><tr valign=""middle"">"
End If
Response.Write "<td align=""center"">"
strSqlTYM = "SELECT DISTINCT M_NAME FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID = " & rsTY("MEMBER_ID")
Set rsTYM=my_Conn.Execute(strSqlTYM)
If Not rsTYM.EOF Then
Response.Write profilelink(rsTYM("M_NAME"),rsTY("MEMBER_ID"))
rsTYM.Close
End If
Set rsTYM = Nothing
rsTY.MoveNext
If Not rsTY.EOF Then
Response.Write ", "
Else
Response.Write "</td>"
End If
Loop
rsTY.Close
End If
Set rsTY=Nothing
intTYAllowed=1
End Sub
%>
Originally posted by CarefreeYes, you need to have all three fields in the SELECT clause.The fields are needed in the query that has the GROUP BY clause but here, since you are SELECT from the subquery, the subquery needs the three fields as well, or they wouldn't be in the main query, to start with.
Well, I previously only had group by member_id since that was the only selected field ... that didn't work, same error. So I guess I need to put all three fields in the first select as well as in the distinct select?