Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Thanks Mod Revisited
 New Topic  Reply to Topic
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 4

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 10 March 2015 :  04:40:27  Show Profile  Reply with Quote
It's actually not needed. Leave a blank line where the Thanks_ID is. I was going to use it for a future change, but go without it.
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 10 March 2015 :  15:19:13  Show Profile  Visit Webbo's Homepage  Reply with Quote
I've installed it but get the following error in a reply after the opening post after someone 'thanks' the first post.....

quote:
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



Lines 942-945 read:

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



When thanking a reply to a topic the initial post is also credited with a thanks


Also when clicking to see who has 'thanked' the pop up returns the following error..

quote:
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



It's a MySql databse if that helps at all

Edited by - Webbo on 10 March 2015 16:23:04
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 10 March 2015 :  18:51:37  Show Profile  Reply with Quote
quote:
Originally posted by Webbo


Lines 942-945 read:

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") & ")")



There's nothing wrong with that line that I can detect.

quote:
When thanking a reply to a topic the initial post is also credited with a thanks.
Yes, that's an easy fix, neglected to include a tiny bit of code. I'll make the change as soon as I finish this reply. Done.

quote:
Also when clicking to see who has 'thanked' the pop up returns the following error..

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

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.

There was one other tiny error in "pop_thanks.asp" having to do with counting the topic "thanks". I had neglected to exclude replies. All code has been fixed on the post and on SnitzBitz.

Edited by - Carefree on 10 March 2015 19:30:27
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 11 March 2015 :  02:35:13  Show Profile  Visit Webbo's Homepage  Reply with Quote
Still can't seem to get rid of the error message...

quote:
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


Here's a link to my topic.asp (.txt) with the changes implemented it you wish to take a look: topic.txt
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 11 March 2015 :  04:36:43  Show Profile  Reply with Quote
The lines surrounding 946 in this file:

[scrollcode]
'## Ignore Post mod
if strIgnorePost = "1" then
boolIgnoreReply = ChkIgnoreList(arrIgnoreMemberList, Reply_MemberID)
end if
[/code]

The word "thanks" does not appear. I don't think this is the right file.....
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 11 March 2015 :  13:42:48  Show Profile  Visit Webbo's Homepage  Reply with Quote
My mistake, please try again, both pieces of code start at lines 940 and 1380
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 11 March 2015 :  16:24:23  Show Profile  Reply with Quote
It should work fine the way it is, but it's misbehaving. Replace that block of code with this, maybe MySQL will not hiccup.


         '  ## 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

Edited by - Carefree on 11 March 2015 16:25:37
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 11 March 2015 :  16:41:04  Show Profile  Visit Webbo's Homepage  Reply with Quote
Replacing the first block of code resulted in the following error...

quote:
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



Replacing both blocks of code with the same caused the thread not to display and the initial post to be replaced with an error
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 11 March 2015 :  17:23:37  Show Profile  Reply with Quote
The code isn't the same for both sections. One is for topics, the other for replies. This is the 940 block:


         '  ## 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


This is the 1380 block:


   '  ## 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


When you thank the topic, do you get an error?
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 11 March 2015 :  17:25:32  Show Profile  Reply with Quote
Is anyone else running this on a MySQL database? If so, are you experiencing the errors that Webbo has?
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 11 March 2015 :  17:48:32  Show Profile  Visit Webbo's Homepage  Reply with Quote
Okay,

starting with a new file and the changes above....

when thanking the initial post in the topic I get the following error in the first reply and no other replies show...

quote:
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





Emptying the table (thanks) to start again....

If I 'thank' the first reply in the thread it works

However if I 'thank' the initial post or subsequent replies, whilst they add 1 'thanks' to that it adds a further 4 thanks to the first reply also, and the table in the database looks like this...



Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 11 March 2015 :  20:31:23  Show Profile  Reply with Quote
You have a loop someplace. It definitely won't do that the way I wrote it. I tested this on a pristine (virgin) Snitz installation and it works perfectly. Look for something like this (surrounding the Thanks code).


For i = 1 to 4

or

Do while

or

Do until

Edited by - Carefree on 11 March 2015 20:38:10
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 12 March 2015 :  13:20:27  Show Profile  Visit Webbo's Homepage  Reply with Quote
I thought I'd found the problem and that is with the way that the database was set up as MySql apparently doesn`t like Auto Increment unless the column is Primary

However changing the database table 'thanks' to add auto increment resulted in the following error and also the author of the post below the one I chose to 'thank' being thanked ....

quote:
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




There are three instances where loops are created and they are within the 'Polls' mod code and the 'Active Users' mod code, line 182, 1107 and 1135

Edited by - Webbo on 12 March 2015 13:28:13
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 12 March 2015 :  19:57:30  Show Profile  Reply with Quote
You don't need to worry about the Thanks_ID. It's not necessary for the mod as it stands now. So auto-increment isn't a factor.
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 03 April 2015 :  06:10:58  Show Profile  Reply with Quote
Discovered that screen refreshing can cause thanks counter to increase, so modified code to use "select distinct". Get the update on SnitzBitz.
Go to Top of Page
Page: of 4 Previous Topic Topic Next Topic  
Previous Page | Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.13 seconds. Powered By: Snitz Forums 2000 Version 3.4.07