Web Hosting Talk







View Full Version : Quick mySQL/PhpmyAdmin - Multi Line Replace Command


AllFloydian
01-20-2009, 04:13 PM
Can someone tell me if there is a multi-line phpmyadmin replace command?
I know the single line command... example:
UPDATE database SET state = replace(state, "MN", "Minnesota")
But i'd like to run a multi-line command to do all states at once.
UPDATE database SET state = replace(state, "MN", "Minnesota")
UPDATE database SET state = replace(state, "CA", "California")
UPDATE database SET state = replace(state, "TN", "Tennessee")
Any ideas?
It can be with direct mysql and/or phpmyadmin.

ThatScriptGuy
01-20-2009, 04:47 PM
You've answered your own question.
UPDATE database SET state = replace(state, "MN", "Minnesota");
UPDATE database SET state = replace(state, "CA", "California");
UPDATE database SET state = replace(state, "TN", "Tennessee");
Put that in the SQL box in phpmyadmin, and it will run 3 queries to do 3 replacements.

01globalnet
01-20-2009, 07:24 PM
The semicolons in the end of each query is the answer to your question :)

HivelocityDD
01-21-2009, 09:02 AM
Yea use semicolon and execute the script.