PHP, MySQL & multiple commands??

From: Date: Fri, 26 Jul 2002 00:50:41 +0000
Subject: PHP, MySQL & multiple commands??
Groups: php.general 
Request: Send a blank email to php-general+get-109638@lists.php.net to get a copy of this message
I'd like to be able to run a mysql_query() once while executing more than one mysql command... for example: while($row = mysql_fetch_array($result)) { $query_cmd = "INSERT INTO tblTest1 (number) VALUES (1);"; $query_cmd .= "INSERT INTO tblTest2 (id, val) VALUES(LAST_INSERT_ID, 'some data');"; mysql_query($query_cmd); } When I run code similar to that listed above, I get a mysql error "error at line 1." -- however, if I run the INSERTS separately -- no error. Is there a way I can run multiple commands within one string? Thanks Jason

« previous php.general (#109638) next »