![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Aug 2012
Posts: 929
|
best way to copy and replace 1000 words in Database?
download .sql and open in dreamweaver then do copy and replace word? tnx
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,075
|
Quote:
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 .
__________________
All cookies cleared! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Denmark
Posts: 213
|
What do you mean copy exactly? You can probably solve your problem with SQL alone.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 | |
<&(©¿©)&>
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
|
Quote:
![]()
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000 Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager ![]() Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
marketer.
Industry Role:
Join Date: Aug 2006
Location: bcn
Posts: 2,280
|
http://davidwalsh.name/mysql-replace
basically what sarettah said just write a script to cycle through your 1000 words and do the sql (if u mean1000 seperate words to replace) |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,075
|
Quote:
If it is 1000 different words then yeah, you want to do up a quick little script for that. .
__________________
All cookies cleared! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
<&(©¿©)&>
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
|
If you need someone to do a quick script to do that for you, icq me 33375924 or email me at woj at wojfun dot com
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000 Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager ![]() Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,075
|
Quote:
j/k.. Can't go wrong with WOJ ![]() .
__________________
All cookies cleared! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Industry Role:
Join Date: Jul 2012
Posts: 3,068
|
Where I used to work we would run like this
Select from table where id="1"; UPDATE table SET id="1" where id="2" ; Select from table where id="1"; Rollback; After the SQL ran, View the output results to verify it ran successfully. Then run it without the rollback line. This was with DB2 though. I don't know about MySQL.
__________________
Live Sex Shows |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | |
Confirmed User
Industry Role:
Join Date: May 2009
Location: Onboard an airplane around the globe
Posts: 3,734
|
Quote:
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!
__________________
---------------------------------------------------------------------------------- The truth is not affected by the beliefs, or doubts, of the majority. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | |
marketer.
Industry Role:
Join Date: Aug 2006
Location: bcn
Posts: 2,280
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
¯\_(ツ)_/¯
Industry Role:
Join Date: Aug 2004
Posts: 11,475
|
textpad, f8, go!
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 | |
marketer.
Industry Role:
Join Date: Aug 2006
Location: bcn
Posts: 2,280
|
Quote:
quick basic script in php assuming using old mysql_ funcs PHP Code:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 | |
<&(©¿©)&>
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
|
Quote:
update tablename set field=replace(field,'string_to_replace','string_to _replace_with') like sarettah explained earlier...
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000 Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager ![]() Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,075
|
Just a little followup.
If this is indeed searching and replacing a list of 1000 different words, be careful because it is very easy to screw yourself up. You need to look through the list of replacements. If you are using a word as a replacement word and somewhere else using that word as the word to be replaced then you need to make sure that you do them in the proper order. for example: I want to replace: word 1 with word 2 word 2 with word 3 If I do them in that order then I will replace word 1 with word 2. On the next replace word 2 with word 3 I will be replacing all the original word 2s and all the word 2s that I just created with my replace word 1 with word 2. So, to achieve the actual results I want I need to do them backwards. I need to first replace word 2 with word 3 then I can do the replace of word 1 with word 2. That make sense? .
__________________
All cookies cleared! |
![]() |
![]() ![]() ![]() ![]() ![]() |