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/Code)
 Decrease members post count on post deletion
 New Topic  Reply to Topic
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 4

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 20 April 2008 :  08:34:23  Show Profile  Reply with Quote
Great mod and all seems to work..
However, I have noticed the following:
Member adds a post
post count =0
Moderator approves post
post count =1
Member deletes his/her post
Post Count =0
then go to members.asp
Post Count=0 as it should however, the next column 'Last Post' still shows todays date.
Should this database field be triggered to reflect the reduction in post counts.
Obviously when a member has multiple posts if a post is deleted the last post will; read his last posting..
Any solutions please...
rgds andy
<
Go to Top of Page

modifichicci
Average Member

Italy
787 Posts

Posted - 20 April 2008 :  10:12:57  Show Profile  Visit modifichicci's Homepage  Reply with Quote
I think it is a little complicate to reset lastpost date, as we have to memorize previous date and when post is deleted we have to ripristinate old date..
hard with simply coding and without a db modification..<

Ernia e Laparocele
Forum di Ernia e Laparocele
Acces - MySql Migration Tutorial
Adamantine forum

Edited by - modifichicci on 20 April 2008 10:13:22
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 20 April 2008 :  10:40:16  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
quote:
Originally posted by modifichicci

I think it is a little complicate to reset lastpost date, as we have to memorize previous date and when post is deleted we have to ripristinate old date..
hard with simply coding and without a db modification..


You'd just need a SQL query to be executed...

<


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

modifichicci
Average Member

Italy
787 Posts

Posted - 20 April 2008 :  10:44:57  Show Profile  Visit modifichicci's Homepage  Reply with Quote
mmmm but how we can know when an user delete a post? and what of his posts?
if you can give some advice on SQL query I can give a look at it..<

Ernia e Laparocele
Forum di Ernia e Laparocele
Acces - MySql Migration Tutorial
Adamantine forum
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 20 April 2008 :  11:27:05  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
Am example query good both for MySQL and SQL Server would be:

SELECT MAX(T_DATE) As T_DATE FROM
(
SELECT MAX(T_DATE) AS T_DATE FROM FORUM_TOPICS  WHERE T_AUTHOR=1
UNION
SELECT MAX(R_DATE) AS T_DATE FROM FORUM_REPLY WHERE R_AUTHOR=1
UNION
SELECT MAX(R_DATE) AS T_DATE FROM FORUM_A_REPLY WHERE R_AUTHOR=1
UNION
SELECT MAX(T_DATE) AS T_DATE FROM FORUM_A_TOPICS  WHERE T_AUTHOR=1
) As T

You'd just need change it to change it to use the forum_prefix and such and to get the member_id from a suitable forum variable. I don't know the context, so can't help much more.

Running the query will give you the last post date for a user. You can then use it to update it in the members table.<


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

modifichicci
Average Member

Italy
787 Posts

Posted - 20 April 2008 :  11:37:51  Show Profile  Visit modifichicci's Homepage  Reply with Quote
and then insert T in M_LASTPOSTDATE in members table where T_AUTHOR etc etc.. right?<

Ernia e Laparocele
Forum di Ernia e Laparocele
Acces - MySql Migration Tutorial
Adamantine forum
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 20 April 2008 :  12:26:12  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
No, T is the alias given to the table resulting from the "inner" UNION. I've just changed the query to have the returning value being named T_VALUE, so insert T_VALUE in M_LASTPOSTDATE in the members table.

I could try a syntax do it all in a single query, but I'm not sure all MySQL versions would support it, or even if the syntax would be valid both for MySQL and SQL Server.<


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

modifichicci
Average Member

Italy
787 Posts

Posted - 20 April 2008 :  13:12:38  Show Profile  Visit modifichicci's Homepage  Reply with Quote
it is possible to add also A_REPLY and A_TOPICS in query? Thanks for help, I will try to implement this function also..<

Ernia e Laparocele
Forum di Ernia e Laparocele
Acces - MySql Migration Tutorial
Adamantine forum
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 20 April 2008 :  13:18:00  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
quote:
Originally posted by modifichicci

it is possible to add also A_REPLY and A_TOPICS in query? Thanks for help, I will try to implement this function also..


Yeah, it's possible, just changed the SQL for that.<


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

modifichicci
Average Member

Italy
787 Posts

Posted - 20 April 2008 :  13:23:48  Show Profile  Visit modifichicci's Homepage  Reply with Quote
ok thanks!

I will work on it.
<

Ernia e Laparocele
Forum di Ernia e Laparocele
Acces - MySql Migration Tutorial
Adamantine forum
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 20 April 2008 :  13:33:53  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
You're welcome.<


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

modifichicci
Average Member

Italy
787 Posts

Posted - 20 April 2008 :  15:18:17  Show Profile  Visit modifichicci's Homepage  Reply with Quote
I have tryed this query:

strUpLastPost = Reply_Autore
strSql = "SELECT MAX(T_VALUE) As T_VALUE FROM "
strSql = strSql & "( SELECT MAX(T_DATE) AS T_VALUE FROM " & strTablePrefix & "TOPICS  WHERE T_AUTHOR = " & strUpLastPost
strSql = strSql & " UNION "
strSql = strSql & "SELECT MAX(R_DATE) AS T_VALUE FROM " & strTablePrefix & "REPLY WHERE R_AUTHOR = " & strUpLastPost
strSql = strSql & " UNION "
strSql = strSql & " SELECT MAX(R_DATE) AS T_VALUE FROM " & strTablePrefix & "A_REPLY WHERE R_AUTHOR = " & strUpLastPost
strSql = strSql & " UNION "
strSql = strSql & " SELECT MAX(T_DATE) AS T_VALUE FROM " & strTablePrefix & "A_TOPICS  WHERE T_AUTHOR = " & strUpLastPost
strSql = strSql & ") As T "
response.write strSql
set rs = my_Conn.Execute (strSql)
DataUltimoPost = rs("T_VALUE")
rs.close
set rs = nothing
				
				
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET M_LASTPOSTDATE = '" & DataUltimoPost & "'" 
strSql = strSql & " WHERE MEMBER_ID = " & strUpLastPost
       
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords


and I get this strSql and the error below..


SELECT MAX(T_VALUE) As T_VALUE FROM ( SELECT MAX(T_DATE) AS T_VALUE FROM FORUM_TOPICS WHERE T_AUTHOR = 1 UNION SELECT MAX(R_DATE) AS T_VALUE FROM FORUM_REPLY WHERE R_AUTHOR = 1 UNION SELECT MAX(R_DATE) AS T_VALUE FROM FORUM_A_REPLY WHERE R_AUTHOR = 1 SELECT MAX(T_DATE) AS T_VALUE FROM FORUM_A_TOPICS WHERE T_AUTHOR = 1) As T

error '80040e14'

some advices?<

Ernia e Laparocele
Forum di Ernia e Laparocele
Acces - MySql Migration Tutorial
Adamantine forum
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 20 April 2008 :  15:37:58  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
You're missing a " UNION " between the 3rd and 4th queries. I've added it in red.<


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

modifichicci
Average Member

Italy
787 Posts

Posted - 20 April 2008 :  16:04:34  Show Profile  Visit modifichicci's Homepage  Reply with Quote
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[MySQL][ODBC 3.51 Driver][mysqld-4.0.27-standard-log]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 'SELECT MAX(T_DATE) AS T_DATE FROM FORUM_TOPICS WHERE T_AUTHOR

I have changed T_VALUE to T_DATE, as in original Ruirib query, but the same error with T_VALUE instead of T_DATE

<

Ernia e Laparocele
Forum di Ernia e Laparocele
Acces - MySql Migration Tutorial
Adamantine forum
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 20 April 2008 :  17:07:26  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
Without knowing the actual SQL being generated, it's hard to help.

The code, as you posted it earlier, with the UNION added in red, works in MySQL 4.x and 5.x.<


Snitz 3.4 Readme | Like the support? Support Snitz too
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.14 seconds. Powered By: Snitz Forums 2000 Version 3.4.07