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

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

WBOY
Release: 2016-06-13 12:14:56
Original
1009 people have browsed it

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

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

------解决思路----------------------
这样才行
update table set A = replace(A,'\\','')
Copy after login
Copy after login

------解决思路----------------------
图中显示的只是 1 个 \ 字符,而你主贴中描述的是 \,.
目标错了,结果怎么能正确呢?

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

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template