PDA

View Full Version : MySQL Help



iUnknown
21-07-2008, 06:54 PM
Hello,

I'm about to run something and I want to check this is definitely correct. It's going to be updating many rows.

Right so I've got a database, and I'm in it in phpMyAdmin. I go into a table called cc_servers. Under structure it shows many fields, one is "messengercontrol".

If I go into browse, there are hundreds of rows. I want to update messengercontrol in all these rows to "enabled".

Do I run this SQL:

UPDATE cc_servers SET messengercontrol=enabled ;

Will that be ok? I'm not 100%.

Thanks.

Joe!
21-07-2008, 07:00 PM
Im pretty sure it would be "UPDATE `cc_servers` SET `messengercontrol` = 'enabled';" I'm not 100% sure of this, so you may want to wait for another member to post as well.

Excellent1
21-07-2008, 07:07 PM
Im pretty sure it would be "UPDATE `cc_servers` SET `messengercontrol` = 'enabled';" I'm not 100% sure of this, so you may want to wait for another member to post as well.Correct.

iUnknown
21-07-2008, 07:26 PM
Alright, I just want to be 100% sure, if I'm running it on phpMyAdmin I just enter:

UPDATE `cc_servers` SET `messengercontrol` = 'enabled';

And that'll work? (without "" around it)

Also, will this set each row to have messengercontrol enabled - even if some have it enabled already?

MrCraig
21-07-2008, 07:33 PM
ye thatl work

Excellent1
21-07-2008, 07:35 PM
Alright, I just want to be 100% sure, if I'm running it on phpMyAdmin I just enter:

UPDATE `cc_servers` SET `messengercontrol` = 'enabled';

And that'll work? (without "" around it)

Also, will this set each row to have messengercontrol enabled - even if some have it enabled already?It will set all the rows enabled and will just surpass the ones already enabled I'm guessing.

L?KE
22-07-2008, 08:20 AM
Both ways will work, just the second one posted is better syntax.

Dentafrice
22-07-2008, 11:53 AM
If you have some rows enabled..



UPDATE `cc_servers` SET messengercontrol = 'enabled' WHERE messengercontrol = 'disabled'
No use updating every row even if it is enable.

If the all the rows are blank..



UPDATE `cc_servers` SET messengercontrol = 'enabled' WHERE messengercontrol = ''

Want to hide these adverts? Register an account for free!