开发者

replace directory path to url path in mysql database table

Dear all..before i give up after multiple trial and error attempts,can someone please help me wi开发者_如何学Goth below query.

I am trying to replace the path name D:\Downloads\Music\ (note the slash) to http://mysite.com/Music/ in mysql field name called "filename" under "songlist" table.

Below is the query code that I tried ,but nothing happens.It only gives me the following message : 0 row(s) affected. ( Query took 0.1428 sec )

UPDATE songlist SET filename = replace(filename, "D:\Downloads\Music", "http://mysite.com/Music/")

many thanks for the help!!!


You need to escape the slashes. Check out the following as an example:

-- with escaping, yay it works
SELECT REPLACE(filename, 'D:\\Downloads\\Music', 'http://mysite.com/Music/') FROM songlist;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜