PDA

View Full Version : Replace Query


Murty
08-04-2006, 12:16 AM
Hey guys, i posted this in the mysql forums but noone has replied yet, just wandering if you guys might be able to help me.
Thanks

Hey guys,
Im new here and i have one question.
I have vbulletin forum installed on my website and obviously it uses mysql database.
Here is my situation.
I have this 'Thanks' system incorporated into it, which has added a field ('post_thanks_amount') to the 'post' table. When a user is thanked (in a post) the value in the 'post_thanks_amount' field goes up by one.
A couple users abused this system and i want to reset the 'post_thanks_amount' value back to 'o' their 150 or so posts. (obviously to big to manually go through and do it). How can i do this.
I guess the following fields would need to be used.
- 'username'
- 'post_thanks_amount'
(they are both in the 'post' table')

pyro.699
08-04-2006, 12:41 AM
UPDATE `user` set `post_thanks_amount` = '0' WHERE `userid` = '#USERID#' LIMIT 1;

Murty
08-04-2006, 01:39 AM
put that in and replaced #USERID# with the users id, and it came back saying:

Error

SQL query:

UPDATE `user` SET `post_thanks_amount` = '0' WHERE `userid` = '149' LIMIT 1 ;

MySQL said: Documentation
#1054 - Unknown column 'post_thanks_amount' in 'field list'

its ok i ended up doing it this way and it worked.
UPDATE `post` set `post_thanks_amount` = '0' WHERE `userid` = '#USERID#'
thanks for your help

pyro.699
08-04-2006, 09:55 AM
oh, sorry, i dident know where your coloum was set, i thought it was under user. my bad.

Murty
08-04-2006, 12:59 PM
no problem, thanks again