4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Alter table
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Ben
Senior WebHelper
Senior WebHelper


Joined: 08 Jan 2002
Posts: 431
Location: Liverpool - UK

PostPosted: Mon Jul 01, 2002 6:15 pm (22 years, 5 months ago) Reply with QuoteBack to Top

Right I have a mysql DB for me forum and a couple of people seem to have become deleted Sad.

I have backups of the members table and can insert that no problem. The problem is with posts, basically they are associated with their poster by a member id column thingy. When a user is deleted the member id coloumn is set to -1.

What I need to do is run a query to change the member id to 604 where the username is say henry.

I cant for the life of me work out how to do it though.

Any ideas?

________________________________
Ben Scott

Red and White Kop
OfflineView User's ProfileFind all posts by BenSend Personal MessageSend emailVisit Poster's Website
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Mon Jul 01, 2002 6:31 pm (22 years, 5 months ago) Reply with QuoteBack to Top

Something like this should work Question (not an expert though. the idea is all right, but the code isn't Smile):

Code:
REPLACE INTO tablename
SET fieldname=604
WHERE fieldname='Henry';

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Ben
Senior WebHelper
Senior WebHelper


Joined: 08 Jan 2002
Posts: 431
Location: Liverpool - UK

PostPosted: Mon Jul 01, 2002 8:34 pm (22 years, 5 months ago) Reply with QuoteBack to Top

heh, I know the kinda code I need.... just dont know the code Sad

________________________________
Ben Scott

Red and White Kop
OfflineView User's ProfileFind all posts by BenSend Personal MessageSend emailVisit Poster's Website
Ben
Senior WebHelper
Senior WebHelper


Joined: 08 Jan 2002
Posts: 431
Location: Liverpool - UK

PostPosted: Mon Jul 01, 2002 9:22 pm (22 years, 5 months ago) Reply with QuoteBack to Top

Asked on WHT and got the answer...

UPDATE yabbse_messages SET id_member = 604 WHERE postername = 'BOB';

Works fine Smile

________________________________
Ben Scott

Red and White Kop
OfflineView User's ProfileFind all posts by BenSend Personal MessageSend emailVisit Poster's Website
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Tue Jul 02, 2002 1:33 pm (22 years, 5 months ago) Reply with QuoteBack to Top

I was soooo close Smile It was just UPDATE instead of REPLACE Sad

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.13591 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme