PDA

View Full Version : Edit Bulk Field in database


kronnos
06-24-2007, 01:44 PM
Hi,

Have a tricky question here and don't know if it can be done this way but maybe somebody might know.

Lets say in the users table I want to change all the active users (there is a field called active and options are yes and no) So to all users with Active=Yes I would want to change another field in those users, I would want files "type" to =1.

Basicly all Active and And Inactive users have a type=0 and I woudl want to change for active users for type to =1.

Can this be done without going through hundreds of users and changing these files one by one?

Thank You

TheMilkCarton
06-24-2007, 02:12 PM
UPDATE vb_user
SET type = '1'
WHERE active = 'yes'
and replace "vb_" with whatever prefix you're using...

If I understood you correctly? Please don't run that until someone much smarter than me confirms. LOL.

kronnos
06-24-2007, 02:28 PM
Thanks a lot, yes it working now. Oh And i have to put ' ' around yes to make it work.

TheMilkCarton
06-24-2007, 02:41 PM
Try what I had edited it to.. I thought I edited it before you replied but I guess not. lol.

Thanks a lot, yes it working now. Oh And i have to put ' ' around yes to make it work.

You must not have not refreshed again, then. :) I edited it once and forgot the '' and quickly edited it again to fix it.

Glad it works.

Dismounted
06-25-2007, 06:41 AM
Should be:
UPDATE `vb_user`
SET `type` = 1
WHERE `active` = 'yes'
Integers should not be encapsulated with quotes.