9000 rows affected message, but no rows actually changed I'm having a problem with MySQL. When I run the code below, via phpmyadmin:

UPDATE wp_posts 
    SET post_content = REPLACE
        (
        post_content,
        '31.media.tumblr.com/',
        '41.media.tumblr.com/'
        ) 
    WHERE post_content LIKE '%31.media.tumblr.com/%' 
    AND post_content NOT LIKE '%.gif%';


It returns:


  9000 rows affected


If I make a search, it shows that it replaced all the needed things successfully. But if I go and hit the 'EDIT' option in phpmyadmin on one of the rows inside the post_content column, no changes are done inside it; everything stays the same.

What might be the reason?

For me there's something wrong with the code above. Maybe it returns NULL or something and stops the update. If I remove this part:

AND post_content NOT LIKE '%.gif%';


...it does work properly.

The database is a default WordPress one: 

 



Example of data inside post_content:

&lt;p&gt;some text&lt;/p&gt;
&lt;img src="http://31.media.tumblr.com/eet1r5co8so1/tumblr_mzlt6zqeet1r5co8so1.gif" alt="" /&gt;
&lt;img src="http://11.media.tumblr.com/L4B1q/tumblr_ml5i2cGL4B1qz4fjqo1.gif" alt="" /&gt;
other text
&lt;img src="http://51.media.tumblr.com/n42sryL4JG1rda3bfo1/tumblr_n42sryL4JG1rda3bfo1.jpg" alt="" /&gt;
&lt;img src="http://31.media.tumblr.com/eet1r5co8so1/tumblr_noui3gHzxp1qfvouao1_1280.jpg" alt="" /&gt;
some other text
...
I did the same as you did and it worked.

mysql&gt; INSERT INTO `test`.`wp_posts` (`idws_posts`, `post_content`) VALUES ('1', '&lt;img src="http://31.media.tumblr.com/eet1r5co8so1/tumblr_mzlt6zqeet1r5co8so1.gif" alt="" /&gt;');
Query OK, 1 row affected (0.01 sec)

mysql&gt; INSERT INTO `test`.`wp_posts` (`idws_posts`, `post_content`) VALUES ('2', '&lt;img src="http://11.media.tumblr.com/L4B1q/tumblr_ml5i2cGL4B1qz4fjqo1.gif" alt="" /&gt;');
Query OK, 1 row affected (0.00 sec)

mysql&gt; INSERT INTO `test`.`wp_posts` (`idws_posts`, `post_content`) VALUES ('3', '&lt;img src="http://51.media.tumblr.com/n42sryL4JG1rda3bfo1/tumblr_n42sryL4JG1rda3bfo1.jpg" alt="" /&gt;');
Query OK, 1 row affected (0.00 sec)

mysql&gt; INSERT INTO `test`.`wp_posts` (`idws_posts`, `post_content`) VALUES ('4', '&lt;img src="http://31.media.tumblr.com/eet1r5co8so1/tumblr_noui3gHzxp1qfvouao1_1280.jpg" alt="" /&gt;');
Query OK, 1 row affected (0.00 sec)

mysql&gt; 
mysql&gt; SELECT * FROM test.wp_posts;
+------------+----------------------------------------------------------------------------------------------------+
| idws_posts | post_content                                                                                       |
+------------+----------------------------------------------------------------------------------------------------+
|          1 | &lt;img src="http://31.media.tumblr.com/eet1r5co8so1/tumblr_mzlt6zqeet1r5co8so1.gif" alt="" /&gt;        |
|          2 | &lt;img src="http://11.media.tumblr.com/L4B1q/tumblr_ml5i2cGL4B1qz4fjqo1.gif" alt="" /&gt;               |
|          3 | &lt;img src="http://51.media.tumblr.com/n42sryL4JG1rda3bfo1/tumblr_n42sryL4JG1rda3bfo1.jpg" alt="" /&gt; |
|          4 | &lt;img src="http://31.media.tumblr.com/eet1r5co8so1/tumblr_noui3gHzxp1qfvouao1_1280.jpg" alt="" /&gt;   |
+------------+----------------------------------------------------------------------------------------------------+
4 rows in set (0.00 sec)

mysql&gt; 
mysql&gt; UPDATE test.wp_posts 
    -&gt;     SET post_content = REPLACE(post_content,'31.media.tumblr.com/','41.media.tumblr.com/') 
    -&gt;     WHERE post_content LIKE '%31.media.tumblr.com/%' AND post_content NOT LIKE '%.gif%';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql&gt;         
mysql&gt; SELECT * FROM test.wp_posts;
+------------+----------------------------------------------------------------------------------------------------+
| idws_posts | post_content                                                                                       |
+------------+----------------------------------------------------------------------------------------------------+
|          1 | &lt;img src="http://31.media.tumblr.com/eet1r5co8so1/tumblr_mzlt6zqeet1r5co8so1.gif" alt="" /&gt;        |
|          2 | &lt;img src="http://11.media.tumblr.com/L4B1q/tumblr_ml5i2cGL4B1qz4fjqo1.gif" alt="" /&gt;               |
|          3 | &lt;img src="http://51.media.tumblr.com/n42sryL4JG1rda3bfo1/tumblr_n42sryL4JG1rda3bfo1.jpg" alt="" /&gt; |
|          4 | &lt;img src="http://41.media.tumblr.com/eet1r5co8so1/tumblr_noui3gHzxp1qfvouao1_1280.jpg" alt="" /&gt;   |
+------------+----------------------------------------------------------------------------------------------------+
4 rows in set (0.00 sec)

mysql&gt; 


Are not you missing something?