If you have access to the MySQLi (MySQL Improved) plugin then you can use http://us.php.net/manual/en/mysqli.multi-query.php <http://us.php.net/manual/en/mysqli.multi-query.php> - Sean
On Fri, Sep 10, 2010 at 1:59 PM, Michael Jones <[email protected]> wrote: > We have an application that I'm converting to PHP. There are several places > that do something like this: > > $query = "START TRANSACTION;" > $query+= "INSERT INTO a (.....)" > $query+= "INSERT INTO b (...)" > $query+= "SELECT LAST_INSERT_ID() as ID" > $query+= "COMMIT" > > Since mysql_query doesn't support multiple queries per statement, what is > the best way to do this in PHP? Right now I'm using a transaction class to > put each query in an array and loop them, but efficiently handling any > return results is a bit of a puzzle. > > Any ideas? > > Sent from my iPhone > > _______________________________________________ > > UPHPU mailing list > [email protected] > http://uphpu.org/mailman/listinfo/uphpu > IRC: #uphpu on irc.freenode.net > _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
