Home >Backend Development >PHP Tutorial >update - php mysql replaces a certain string in the field

update - php mysql replaces a certain string in the field

WBOY
WBOYOriginal
2016-09-14 09:41:33976browse

There is a field in the hypothetical mysql
A user adds three pieces of information as
"Hello, I am very good, Joyse Chen likes you"
"Not good, I am very bad, Joyse Chen likes you"
"How are you, I Very good JoyseChen likes you"

Is it possible to capture the field value such as this string "Joyse Chen"
I want to change it to Chen Loinse
Can I change this string
without touching other strings?
Like this:

"Hello, I'm fine, Chen Loinse likes you"
"No, I'm not good, Chen Loinse likes you"
"How are you, I'm fine, Chen Loinse likes you"

Reply content:

There is a field in the hypothetical mysql
A user adds three pieces of information as
"Hello, I am very good, Joyse Chen likes you"
"Not good, I am very bad, Joyse Chen likes you"
"How are you, I Very good JoyseChen likes you"

Is it possible to capture the field value such as this string "Joyse Chen"
I want to change it to Chen Loinse
Can I change this string
without touching other strings?
Like this:

"Hello, I'm fine, Chen Loinse likes you"
"No, I'm not good, Chen Loinse likes you"
"How are you, I'm fine, Chen Loinse likes you"

update TABLE set text=replace(text,'Joyse Chen','Chen Loinse')

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