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

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

WBOY
WBOYOriginal
2016-06-13 12:10:321210browse

怎么替换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 />
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