N
N
Name2018-03-04 08:47:26
PHP
Name, 2018-03-04 08:47:26

Replace in base on a mask?

I am doing the following query in mysql:

UPDATE table SET text = replace(text,'предмет','<a href="/predmet">предмет</a>');

there is a replacement: item with < a href = "predmet "> item a>
please tell me how to correctly compose this request so that there are replacements, including:
item - < a href = "/predmet"> item a>
item - < a href = "/predmet">of item a>
item - < a href = "/predmet">item a>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Tolmachev, 2018-03-04
@User782

Use either Like or RegExp operator in sql query.
If you will process on the php side, use preg_replace

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question