Mass edit rows in phpmyadmin

Discussion in 'MySQL' started by layz, Jun 8, 2010.

  1. #1
    Hey guys. I run a subtitle host and recently i had to change the location of the stored files. Problem is now that i have 300+ rows in phpmyadmin where "subs/" must be removed from "filename". is there an easy way to do this?

    Regards
     
    layz, Jun 8, 2010 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    UPDATE my_table SET my_column_i_need_to_fix = REPLACE(my_column_i_need_to_fix, 'subs/', '');

    Make sure to do a backup of the table before running in case anything gets messed up.
     
    jestep, Jun 8, 2010 IP
  3. layz

    layz Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hey jestep, thanks for your reply. i will try this after making a backup.

    backup done. just to be clear the command should look like this:
    UPDATE subs SET filename = REPLACE(filename, 'subs/', '');

    correct?
     
    Last edited: Jun 8, 2010
    layz, Jun 8, 2010 IP
  4. layz

    layz Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    it worked perfectly, thank you jestep!
     
    layz, Jun 8, 2010 IP