DB内には、
<img src="../img/header.png" alt="" /><input type="image" src="../img/apply.png" onclick='$("#xxx").submit()' />
などを含むHTMLコードが格納されています。
このHTMLコードのURL部分の"img"を"images"に置換して
<input type="image" src="../images/apply.png" onclick='$("#xxx").submit()' /><img src="../images/header.png" alt="" />」
などに置き換えたいと思っています。
そこで
SQL
1SELECT * FROM `table1` WHERE `input_body` LIKE '%//img//%' ESCAPE '/'
で検索に引っかけることはできました。
しかし、
SQL
1UPDATE table1 SET input_body = REPLACE(input_body, '/img/', '/images/')
SQL
1UPDATE table1 SET input_body = REPLACE(input_body, '//img//', '//images//')
などのようにしても実行はされるものの、「 0 行変更しました。」となり、データが変更されません。
エスケープしなければならないのかと思い、試しに
SQL
1UPDATE table1 SET input_body = REPLACE(input_body, '//img//', '//images//') WHERE `id` =125 ESCAPE '/'
とすると
#1064 - 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 'ESCAPE '/'' at line 1
というエラーになってしまいます。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。