Executing multiple SQL statements in MySQL

From: Date: Mon, 12 Mar 2001 20:54:24 +0000
Subject: Executing multiple SQL statements in MySQL
Groups: php.db 
Request: Send a blank email to php-db+get-7345@lists.php.net to get a copy of this message
Now that MySQL has different table types which support transactions (bdb, gemini) it's desirable to build transaction blocks for MySQL PHP driven programs, just like you can for PostgreSQL. When I tried to do this, however, I couldn't find a MySQL equivalent for pg_Exec, which does except multiple SQL statements. mysql_db_query & mysql_query apparently accept only a single SQL statement. If I try to execute the following, it fails with a syntax error at the end of the first statement: = = = = = $transaction_sql = "BEGIN; $add_item_sql; $purchase_queue_sql; $log_sql; COMMIT; "; include "connect.inc"; $result = mysql_db_query("inventory", $transaction_sql, $conn); = = = = = = With PostgreSQL, it works fine (after you change mysql_db_query to pg_Exec!). So, does anyone know of a way to execute multiple SQL statements with MySQL or am I forced to execute one at a time? Thanks in advance, Art

« previous php.db (#7345) next »