Reply to topic
mysql multiple row update
jwwebs


Joined: 04 Mar 2008
Posts: 1
Reply with quote
I am trying to update multiple records,rows,fields in a table. Below is what I am placing in the sql fild in phpmyadmin. It works with one update line but not more. What am I missing here? Doesn't the semicolon end the line and run the next. I don't have a clue and can't find any info online.

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
nathacof


Joined: 24 Oct 2006
Posts: 93
Location: Bear, DE
Reply with quote
If phpMyAdmin is using mysql_query() to execute your statements then it will never process more than one line of SQL at a time:

http://us2.php.net/mysql_query

mysql_query() sends an unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified link_identifier .


But I'd have to look at the source code to tell you if that is truly the case.
darnold


Joined: 17 Mar 2005
Posts: 22
Reply with quote
That is correct. phpMyAdmin will not allow multiple sql queries to run using the sql query window. You could use the GUI to update more than one row in phpMyAdmin or;

What you are attempting to do would be best run using the mysql CLI. From a linux command prompt type:
Code:
mysql -u[username] -p -h[host address] [dbname]


Be sure to replace the brackets and terms with real values.
dbodner


Joined: 21 Dec 2005
Posts: 112
Location: Philadelphia, Pa
Reply with quote
You can run multiple sql queries in pma, as long as the delimiter used in the queries is the same as what you have checked in phpmyadmin. It breaks them up into an array and throws them in a foreach.

Have you tried checking the 'Show this query here again' box? What is the query it spits back to you as what's being run?
mysql multiple row update
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic