Mysql replace() function, help with query (what chars do I escape?)

Posted by jyoseph on Stack Overflow See other posts from Stack Overflow or by jyoseph
Published on 2011-01-04T04:37:26Z Indexed on 2011/01/04 4:54 UTC
Read the original article Hit count: 250

Filed under:
|
|

I am trying to update an old cms where images were stored in /images/editor/, they are now stored in a bucket on amazon s3. I'm trying to update the database using mysql replace. I've done this in the past with replacing simple words, but now Mysql is reporting an error, I suspect because this is more than a simple word:

UPDATE contents SET desc = replace(desc, 
'/images/editor/', 
'http://s3.amazonaws.com/my_bucket/editor/')

Do I need to escape the : or slashes? I've tried escaping it with a '\' to no avail. Can someone get me pointed in the right direction? Thanks!

Edit

Here's the error I am getting, nothing too telling

error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc = replace(desc, '/images/editor', 'http://s3.amazonaws.com/app_navigator/ed' at line 1

© Stack Overflow or respective owner

Related posts about mysql

Related posts about mysql-query