I have some link broken on my site and I need to change a lot of links. My initial idea was to go through MySQL and replace strings like <a href="/old-link/">
with <a href="/new-link/">
.
When I go to Database – Search and enter Search for: <a href="/old-link/">
, select all tables and choose Exact Match, nothing is found. If I choose Any word instead of Exact match, it founds many irrelevant results.
I want to search for exact match for string <a href="/old-link/">
in order to ensure that i don’t replace something that mustn’t be replaced.
I suspect that nothing is found because many special symbols like <>""// are used in my search, but I can’t google any coherent info as to how to put the query correctly. Can somebody help me with this?
P.S. I’ve also run through topics that were suggested by stackoverflow during creation of this question, but didn’t find an answer
P.P.S I updated post with "code" markup as I didn’t know it had to be done beforehand
2
Answers
Just use the sql
replace
functionSolution Provided by @PunitGajjar
As I explained in the comment, you can go with some loops like below.
This is an example with a PHP script.
You can use the same kind of logic with the whatever technologies you are using.
Suggesting you to create an array just because there are chances that you may not have same column name in all the tables you wish to update.