Home > Backend Development > PHP Tutorial > 如何替换MYSQL中某字段的内容,参数替换

如何替换MYSQL中某字段的内容,参数替换

WBOY
Release: 2016-06-13 12:10:32
Original
1212 people have browsed it

怎么替换MYSQL中某字段的内容,参数替换
比如内容是

引用
*********.php?haode=yes********789**********
*********.php?haode=yes********246**********
*********.php?haode=yes********221**********
*********.php?haode=yes********687**********
*********.php?haode=yes********215**********

需要替换成
引用
*********.php?type=789********789**********
*********.php?type=246********246**********
*********.php?type=221********221**********
*********.php?type=687********687**********
*********.php?type=215********215**********





------解决思路----------------------
update tbl_name <br />set field=REPLACE(field, 'haode=yes', CONCAT('type=', SUBSTRING_INDEX(SUBSTRING_INDEX(field, '</b>', 1), '<b>', -1))<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