Home  >  Article  >  Backend Development  >  怎么替换mysql数据库中 A字段中 符号

怎么替换mysql数据库中 A字段中 符号

WBOY
WBOYOriginal
2016-06-13 12:14:56957browse

如何替换mysql数据库中 A字段中 \符号啊
如何替换mysql数据库中  A字段中 \,.这样的英文标点符号
------解决思路----------------------

<br />update table set A = replace(A,'\\,.','你要替换的值') where ...<br />

------解决思路----------------------
这样才行
update table set A = replace(A,'\\','')
 
------解决思路----------------------
图中显示的只是 1 个 \ 字符,而你主贴中描述的是 \,. 
目标错了,结果怎么能正确呢?

在 sql 控制器里
update table set A = replace(A,'\\','')
是正确的
在 php 里,因为要放在双引号中
<br />$sql = "update table set A = replace(A,'\\\\','')";

才是正确的
4 个 \ 经 php 处理后变成 2 个 \ 传递给 mysql
------解决思路----------------------
<br />$sqlstr = "update b set url=replace(url,'\\\\','')";<br />mysql_query($sqlstr) or die(mysql_error());<br />

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn