最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

posts - Wordpress MySQL Search and replace with wildcard?

matteradmin8PV0评论

I'm trying to search and replace for a link with wildcard in phpMyadmin.

If I simulate this query

UPDATE wp_posts SET post_content = REPLACE (post_content, '<a style="text-decoration:none" href="/spammy-url">.</a>','.');

It finds the exact match and will replace them successfully.

However due to the amount of links with different URL's i'd like to wildcard the query, If I navigate to the wp_posts table and do a search and replace, it displays all the correct entries that need to be replaced, however the column showing the "replaced" string doesnt change.

I thought doing the following would do it :

UPDATE wp_posts SET post_content = REPLACE (post_content, '<a style="text-decoration:none" href="%">.</a>','.');

But it's not returning any results. Do wildcards not work with search and replace in this way ?

If someone could explain where I am going wrong that would be great.

UPDATE

I have just tried to run the query via SSH and this is the notice I get :

Query OK, 0 rows affected (0.02 sec)
Rows matched: 3196  Changed: 0  Warnings: 0

So it found the rows required to change, but didnt change them. I think its something to do with the wildcard ( obviously ) but everything im trying comes up with the same result.

Post a comment

comment list (0)

  1. No comments so far