Why execute a MySQL statement, replace the character with the Replace function, but return a result of 0? This SQL statement is written like this:
| The code is as follows |
Copy Code |
UPDATE V9_news_data Set Content=replace (' content ', ' <p>[NextPage]</p> ', ' [Page] ') and pagin=2 where INSTR (' content ', ' <p>[NextPage]</p> ') > 0; |
When the result is done, the desired replacement effect is not implemented and the result is 0. What's going on here.
Then restore the database, remove and pagin=2 this sentence and then try OK, can't the Replace function updata multiple fields at the same time in the UPDATE statement? Then it has to be distributed.
The MySQL repalce function is written in the correct notation:
| The code is as follows |
Copy Code |
UPDATE V9_news_data Set Content=replace (' content ', ' <p>[NextPage]</p> ', ' [Page] ') where INSTR (' content ', ' <p>[NextPage]</p> ') > 0; |
It's best to replace only one field at a time, I don't know if it's the reason for the update, or the content is too long the field character,
| The code is as follows |
Copy Code |
INSTR (' content ', ' <p>[NextPage]</p> ') > 0 |
The following sentence InStr function to determine whether there is this string, it is necessary to add in order to avoid errors.