Hi, Todd: Each of my query snippets look something in the following format: UPDATE product SET product_name = 'SQL Tool UltraLight' AND price='1000' AND sales='200' AND export='299' AND import='399' ....... WHERE id = '1001' I don't think I am allowed to JOIN these queries in the first place according to some of the resources I have been reading. I only think I am allowed to execute the queries one by one. But, in PHP terms, if I have a data executed from somewhere and allow users to edit it, how can I pass along every single one of these variables to the POST? (Is this what you meant by this is not something easy to do?) Thanks in advance. Alice > Subject: RE: How to Execute Multiple SQL Updates Using PHP > Date: Wed, 19 Nov 2008 13:11:48 -0600 > From: tmboyd1@xxxxxxxx > To: ajwei@xxxxxxxxxxxxx; php-general@xxxxxxxxxxxxx > > > -----Original Message----- > > From: Alice Wei [mailto:ajwei@xxxxxxxxxxxxx] > > Sent: Wednesday, November 19, 2008 12:51 PM > > To: php-general@xxxxxxxxxxxxx > > Subject: How to Execute Multiple SQL Updates Using PHP > > > > I am inquiring on this list to see if it is possible to create a > > script that takes multiple update statements without my having to > write > > one "SQL" statement for each of the updates. > > > > I have a scenario of which I create a table of some sort with some > > existing information using Flex, and what I am told by my client is > > that no matter how many records there are on the screen, the users > > should be able to update any up to all the entries by simply pushing a > > button. I use Microsoft SQL, which I think that it does allow multiple > > update query execution. The problem is that I might have to come up > > with some method to accept all the "POST" variables the user provides > > into the script. > > > > Could anyone please give me some guidance on what kind of function > I > > might use, or whether or not it is possible I can create a script that > > accepts as many "POST" variables as the users POST? > > > > Thanks a lot for your help. > > ...sounds like more of a structure question than a PHP question, to be > honest. So, structurally speaking, I would build your app to name the > fields in a manner that is easily packaged and transported. That way, > you can just do a for-each loop on the $_POST array and extract them > using hints in your packaging method to tell which row and columns (and > values) are being placed in the SQL query. You can name your fields > something like "customerName[0]", "customerName[1]", etc., and PHP will > treat them as an array when they are unpackaged from the $_POST > parameters. > > As for multiple SQL statements in one query, I don't see why creating a > TRANSACTION block with multiple statements (separated by a semicolon: > ';') wouldn't be possible in PHP. I've never tried it personally, but > you are theoretically just passing your SQL server a query string--it > handles the rest. (Yes, it's a bit more complex than that... but that's > the brass tacks.) > > HTH, > > > // Todd _________________________________________________________________ Express yourself with gadgets on Windows Live Spaces http://discoverspaces.live.com?source=hmtag1&loc=us