Re: [PHP] How to Execute Multiple SQL Updates Using PHP



On Wed, Nov 19, 2008 at 2:51 PM, Ashley Sheridan
<ash@xxxxxxxxxxxxxxxxxxxx>wrote:

On Wed, 2008-11-19 at 18:51 +0000, Alice Wei wrote:
Hi,

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.

Alice

_________________________________________________________________
Check the weather nationwide with MSN Search: Try it now!
http://search.msn.com/results.aspx?q=weather&FORM=WLMTAG
When I'm stuck on queries I always fall back to see how phpMyAdmin would
treat it. Do a dummy run in there by updating a few rows of information
at once, and then see what the SQL it produces looks like. You can
perform multiple queries by using semicolons. Bear in mind that the
queries are still treated as separate, so you may want to do them as a
transaction if you need to fall back in-case of a problem.


Ash
www.ashleysheridan.co.uk


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


One thing to watch there is that you don't exceed the max query size limit
(which looks to be about 64K in size) for the sql string

--

Bastien

Cat, the other other white meat


Relevant Pages

  • Re: composite key question
    ... Each time you do an insert SQL ... it's probably not a stored procedure. ... queries to perform slower, however. ... Seeing as how that script you sent was not a stored proc, ...
    (microsoft.public.sqlserver.programming)
  • RE: Unusual Linked Server arrangement - How to do it?
    ... Server from a script running on ... Does there exist a way of creating a 'connection' object in a SQL script ... and the exucute the script on that server where you wnat to run your queries. ...
    (microsoft.public.sqlserver.server)
  • Re: Vista hosting XPe tools/db
    ... Are you running this script on the machine that actually has the SQL server ... machine hosting the database. ... i don't know if you can install a second instance of SQL ...
    (microsoft.public.windowsxp.embedded)
  • Re: ActiveX script works in DTS but not in job, why?
    ... Account that SQL Agent runs under and it is a Local Admin on the box. ... As another test I saved the script as a .vbs file and tried running it, ... Microsoft OLE DB Provider for SQL Server ... that would be since I need to be able to load DTS packages from either a SQL ...
    (microsoft.public.sqlserver.dts)
  • Re: Enterprise Manager Newbie Question
    ... a SQL backup is not a simple copy of the database files. ... Is it possible to write a script that one could run from a workstation and ...
    (microsoft.public.sqlserver.tools)