What is the use of this method?
That is, our zblog website, after changing the theme, wants to call the content of the old theme log_Meta field in the new theme, but the key names of the new theme and the old theme are different.
For example, if you use a product theme, the price key for the new theme is price (the call variable is: $article->Metas->price), and the price key for the old theme is jiage (the call variable is: $article->Metas->jiage).
We want to change jiage to price, so how to modify it in batches?
SQL commandas follows
UPDATE zbp_post
SET log_Meta = REPLACE(log_Meta, 's:5:"jiage";', 's:5:"price";');Please note that the length of the characters cannot be wrong!
If the original price key name is also included, the original price key name of the new theme is oldprice, and the original price key name of the old theme is yuanjia. Combined with the order to replace the price, how should we execute it?
The sql command is as follows
UPDATE zbp_post
SET log_Meta = REPLACE(REPLACE(log_Meta, 's:5:"jiage";', 's:5:"price";'), 's:7:"yuanjia";', 's:8:"oldprice";');Finally, you have to execute the sql command in phpmyadmin







add friends