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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.