Quote:
Originally Posted by sarettah
If you do that then you also have to have a way to put that back into the database, I assume.
If you are doing all occurrences of a certain word within a table/field than you can do it with a sql update either at the mysql command line or through something like phpmyadmin.
update tablename set field=replace(field,'string_to_replace','string_to _replace_with')
always check yourself first by doing a select using the same syntax to make sure your results will be what you want them to be. Then do a copy of the table before you do the update, just to be 100% sure.
select field, replace(field,'string_2_replace','string_to_replac e_with') from tablename
.
|
Do this, and follow Woj's precaution tips.
What I do, is to build a list of the words I want to replace, put them in Excel, in column A and downwards as far as I need to go (remember to use import as csv or whatever file format you have your 1000 words in).
And then do the same for column B for the words you want to replace with.
Then build a function, in column C, like:
update tablename set field=replace(A1','B1');
where A1 is the word you want to replace and B1 the word you want to replace with. Double click on the black square in the excel cell and let it auto fill downwards.
And then in column D, build then all together, with the & sign, like this:
=C1&C2&C3&C4
to make it return:
update tablename set field=replace(A1','B1');
update tablename set field=replace(A2','B2');
update tablename set field=replace(A3','B3');
update tablename set field=replace(A4','B4');
Then copy the full
update tablename set field=replace(A1','B1');
update tablename set field=replace(A2','B2');
update tablename set field=replace(A3','B3');
update tablename set field=replace(A4','B4');
and paste it into phpmyadmin in the SQL command line and run it.
Just remember that it is, indeed, very powerful, one mistake from you along the way and changes will be done accordingly, so be very careful and take al the necessary precautions!