Re: running multiple updates on a single line

From: Date: Tue, 04 Jul 2006 13:08:15 +0000
Subject: Re: running multiple updates on a single line
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-239119@lists.php.net to get a copy of this message
Ryan A wrote:
--- Chris <dmagick@gmail.com> wrote:
Ryan A wrote:
Hi, in phpmyadmin, in the SQL part where you can write
a
query if I have a double update such as this: it works without a problem as I am ending each sql statement with a simicolon, but in my scripts when
I
try to run multiple updates in a single line eg: $xyz="update xyz set id=1 where id=0;update xyz
set
id=3 where id=2;"; it does not work... any idea why?
-->Chris
try a newline between the queries then phpmyadmin will see them as separate queries and run them properly.
@Chris, Tried that... no joy. -->João
Could any of these lines cousing an error?
@João, nope, I broke them down to different statements , put them into an array and ran them in a for() loop and it works perfectly... problem is, sometimes I have to run upto 15 updates at a time, would be great if I can run that in one statement. --> Robert
RTFM :) -- mysql_query()
Ok, read it, again.... what am I missing? I took out the semicolon from the end... then I get an error. I did find one user post saying that this runs just one query at a time...but if thats the case how is PHPMyAdmin running multiple statements that are seperated by a semicolon? Thanks! Ryan because it manually splits them on the semicolon and runs each one trough mysql_query separately.


« previous php.general (#239119) next »