Home > Database > Mysql Tutorial > body text

mysql批量删除特殊字符串

WBOY
Release: 2016-06-07 17:52:25
Original
964 people have browsed it

UPDATE 数据表名 SET
字段名 = replace(字段名, '要替换的字符串', '替换为')
WHERE 设定条件;

语法

 代码如下 复制代码

UPDATE wp_posts SET
post_content = replace(post_content, '<script>', '');</script>

这样是错误的,看下面

 代码如下 复制代码

update pw_advert set config = replace(config, substring(config, locate('

替换成功了。原因* ?是mysql通配符哦,不能直接替换哦。

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!