Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

For example with the following query I can select all the records I want to change, but then how do do the change? e.g. change all occurences of "seven" to "four"?

SELECT * FROM `templates` WHERE `attrib_B` LIKE `seven`

This is how I think of it in pseudo code:

if `attrib_B` like `seven`:
    set `attrib_B` = `four`

Thanks.

share|improve this question

3 Answers 3

up vote 1 down vote accepted
UPDATE `templates` set `attrib_b` = 'four' WHERE `attrib_B` like 'seven';
share|improve this answer
1  
Just a side note that this is SQL and not specific to phpMyAdmin. –  Michael Mior Jan 6 '10 at 21:58
    
thanks! that's perfect. I was pulling my hair out. :) –  matt wilkie Jan 6 '10 at 22:01
    
I removed the phpmyadmin specificity –  matt wilkie Jan 6 '10 at 22:04

[for myPHPAdmin as per original question verbiage]

You can use either the table editor to change the data rows manually (via web interface) or run a SQL UPDATE statement.

Manually updating via web interface:

  1. Click on your table in the menu on the left
  2. Click the Browse tab, which will display the data rows in an HTML table
  3. Click Edit on the row(s) you want to edit
  4. Change the values in the Edit form

Running a SQL UPDATE statement (faster as you can do them all at once):

  1. Click on your table in the menu on the left
  2. Click the SQL tab, which will give you a textbox you can enter a SQL statement into
  3. Use this SQL statement to update all the rows:

    UPDATE 'templates' SET 'attrib_B'='four' WHERE 'attrib_B' LIKE 'seven'

  4. Click the GO button to execute the statement

share|improve this answer
    
thanks squillman. Perhaps preface your answer with [For phpmyadmin] or similar as I've removed that from the question and it now appears out of context, but isn't. sorry for adding confusion! –  matt wilkie Jan 6 '10 at 22:06

The question has already been answered, so I won't redo that but thought it might be handy to pass on a little tip for the future. It's helped me avoid excessive page turning of the manual many times.

An easy way to search the MySQL documentation is to use the URL http://dev.mysql.com/doc/, followed by your search term. e.g.

http://dev.mysql.com/doc/insert ignore

will search the online documentation for "insert ignore".

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.