2011-12-23 19 views
1

如何使用mysql更新命令搜索引號? 我使用下面的命令,但它找不到任何東西。Mysql更新:如何搜索帶引號的字符串

update ibf_posts set post = replace(post, 'src="style_emoticons', 'src="/public/style_emoticons'); 
+1

首先做一個選擇,看看你是否發現任何post =你的標準。 '從ibf_posts中選擇帖子後LIKE'%src =「style_emoticons%''我的猜測沒有任何更新,因爲您沒有與您的搜索條件完全匹配的記錄 – xQbert 2011-12-23 12:16:45

回答

1

你嘗試逃避他們:

update ibf_posts set post = replace(post, 'src=\"style_emoticons', 'src=\"/public/style_emoticons'); 
+0

Thanks。Worked。 – 2011-12-23 12:17:05

+0

您是否接受答案? – 2011-12-23 12:22:15

+0

@Crazy_Bash - 這真的有用嗎?''src = \「style''與src =」style''完全一樣: - ? – 2011-12-23 12:23:16

0
update ibf_posts set post = 'src="style_emoticons' where POST = 'src="/public/style_emoticons'); 
0

你的代碼工作正常如果有匹配

SELECT replace('<a src="style_emoticons">', 'src="style_emoticons', 'src="/public/style_emoticons') 

...打印:

<a src="/public/style_emoticons">