SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Nov 2001
    Fort Lauderdale
    0 Post(s)
    0 Thread(s)

    Unhappy To the gurus, is it possible to create a statement that matches only part of a value?


    I'm not even sure if this is possible, but here is the scenario:

    1. I have a table called dir_websites
    2. In that table, I have a field/column called "url"

    Now this table is filled with entries that have a similar URL containing "folderA" in it. For example:


    I want to change all the entries in the table that has the "folderA" in it's url to not contain the "folderA" part in their url. For example:



    Basically the website moved it's development website in the /folderA/ folder, to the live website on root. However all the urls were hardcoded with /folderA/ in the database table.

    There are over 280 entries in the table.

    I don't need the PHP version because I would like to just run the sql statement in phpmyadmin.

    Is something like the above possible or am I out of luck?

    Thank you in advance.

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    163 Post(s)
    4 Thread(s)
    Code MySQL:
    UPDATE dir_websites
    SET url = CONCAT('', SUBSTR(url, 33))
    WHERE url LIKE ''


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts