MYSQL Replace

Discussion in 'MySQL' started by aaron_nimocks, Nov 3, 2006.

  1. #1
    Looking for a statement to accomplish this task.

    My row is named URL in my table named myspace.

    I want to replace all the URL's with a different one.

    So I want it to go through every URL field no matter whats in it and then replace it with http://www.whatever.com

    Thanks. :)
     
    aaron_nimocks, Nov 3, 2006 IP
  2. disgust

    disgust Guest

    Messages:
    2,417
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    0
  3. aaron_nimocks

    aaron_nimocks Im kind of a big deal Staff

    Messages:
    5,563
    Likes Received:
    627
    Best Answers:
    0
    Trophy Points:
    420
    #3
    read it already and dont understand it. Thats why I was asking for someone to help me out with posting the statment.

    I guess I could use UPDATE also.

    would it be something like this?

    UPDATE pld_link SET url='new value' WHERE url='everything'
    PHP:
    Not sure if that would work and what to put for everything. I want to replace every field.
     
    aaron_nimocks, Nov 3, 2006 IP
  4. disgust

    disgust Guest

    Messages:
    2,417
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    0
    #4
    er, oops. misread your original post. replace isn't appropriate. or may not be, anyway. use update.

    $query = "UPDATE myspace SET url='http://www.site.com'";

    you don't need the WHERE clause.

    and obviously do a backup before you do this or anything like this ;)
     
    disgust, Nov 3, 2006 IP