Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to update fields in table

Status
Not open for further replies.

calidude

Technical User
Dec 11, 2003
24
0
0
US
I am trying to update multiple records,rows,fields in a table. Below is what I am placing in the sql field in phpmyadmin. It works with one update line but not more. What am I missing here? I looked around but can't find the answer.

Code:
 UPDATE Products SET TitleTag='U.S. Air Force Retired Shop On-Line for Flags of the world - US, International Flags ' Where Product_ID=28; 
UPDATE Products SET TitleTag='Vietnam Veterans of America Shop On-Line for Flags of the world - US, International Flags ' Where Product_ID=29;

Thanks for the help
Bob
 
You aren't missing anything, you just can't run more than one query at a time.

What exactly are you trying to accomplish?

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I need to update fields in a table with specific information for each record. For example

product #1 metatitle is "bla bla"
Product #2 metatitle is "bla bla bla"

I don't know sql and only understand the very basics but this would save me from having to update each of the 800+ records one at a time through a browser.

Thanks for the help.
 
How are you getting the data that you need to update?

Usually this type of thing is done from whichever programing language you are using to connect to the database. you would have it run a loop, that updates the records with the relevant information. It is in essence doing it one by one, but it will do them consecutively, and you only need to program it once.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
This is a one shot deal. I am just looking for a quick way of doing the update. I will hunt around some more. Thanks for the info.
 
o.k then again I ask where are you getting the new updated info from? If its in a file you could possibly use the LOAD DATA INFILE command.
Or maybe something else. But we need to know how this is supposed to happen.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Sorry if I am not making sense. The data is in a notepad document I hand typed. I am just trying to update the field for each record with that data. Each record has unique info for that field. I don't have a front end like php. Actually it is a coldfusion storefront software and I am cheating by trying to do a mass update to the mysql database rather than one record at a time through a browser. Maybe even a sql file I just don't know how to get it to loop through each record so the server sees each as an individual update.
 
I believe PHPmyadmin has an option where you can feed it a file with all the commands you want to run. Just create a text file with all your update statements and feed it to phpmyadmin using the option, not the actual sql text box.

You can also use the command prompt to do it if you have access to it.









----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top