PHP SQL Find/Replace/Remove

Discussion in 'PHP' started by JosS, Aug 23, 2007.

  1. #1
    G'day!

    I got this little snippet here to update my SQL database table

    mysql_query("UPDATE names SET origin = LOWER(REPLACE(origin, ' ', ''))") OR die(mysql_error());?>
    PHP:
    That should replace all the spaces with nothing.

    The thing is, in the SQL file,

    If I select the spaces, it's not heaps of spaces, it's one wierd character that is a big space? I don't know how to explain it, but I've tried search and replace software to copy and paste this blank character but it doesn't work.

    The character is in between these quotes: " " (If that even works)

    and here is a screenshot of the character selected..

    [​IMG]

    There's 26,000 records am I forced to just delete this manually? :eek:

    Here is a sample from the SQL file:

    http://www.babynamestar.com/test.sql where you can see the character in WordPad
     
    JosS, Aug 23, 2007 IP
  2. sea otter

    sea otter Peon

    Messages:
    250
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The big space is just a plain old tab character. Use this REPLACE code instead of what you have:

    
    REPLACE(origin, '\t', '')
    
    Code (markup):
    Make that change, and you won't need to process all those records by hand(!)
     
    sea otter, Aug 23, 2007 IP
  3. JosS

    JosS Guest

    Messages:
    369
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, worked a charm!
     
    JosS, Aug 24, 2007 IP