Jump to content

Updating values in coloum


myristate

Recommended Posts

This is fairly simple stuff im about to ask (well i hope it is)

 

I have included a screen shot of my how my table looks from phpmyadmin as i fear my explanation following might suck a bit. Anyway i have a coloum there called "Colour" in it there are four possible colours "red/yellow/blue/white" It has come to my attention that some of the colours for some of the data entries are wrong so my question is how do i update say all the "red" coloured items in that coloum without effecting the other colours. I thought this might possibly do it. However i cant afford to run it without knowing if it will work or not. :

 

"UPDATE $db_table SET colour = 'Blue' WHERE colour = 'Red' ");

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/231183-updating-values-in-coloum/
Share on other sites

i cant afford to run it without knowing if it will work

 

^^^ That's why you would do this on some test data first. In programming, it's generally going to take you a lot less time to make a test case and try your solution so that you can conform if it does what you expect, than what it will take to post a question in a forum somewhere and hope you get an accurate answer to your question. And if this is a one time update, you can just do it directly in phpmyadmin without needing to write any php code.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.