SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2007
    Location
    London, United Kingdom
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem searching and replacing ' \ '

    Hi

    I have a problem searching and replacing paths in my database:

    I want to change all paths from : \new\new1\new2\image.jpg

    to: /new/new1/new2/image.jpg

    I am trying the following SQL statement but it doesn't work.

    code:

    update menu set image = replace(image, "\", "/");

    What am I doing wrong???

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,786
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    replace(image, "\\", "/")
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2006
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    UPDATE table SET field=REPLACE(table.field, '\\','/');

  4. #4
    SitePoint Zealot
    Join Date
    Jun 2007
    Location
    London, United Kingdom
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    excellent, works!

    many thanks


Bookmarks

Posting Permissions

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