01-28-2008, 06:41 PM
|
#1 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,216
Thanks: 17
|
Multiple mysql queries
Its been bugging me on how to do multiple mysql queries without a new mysql_query statement being called each time. This essentially calls a new one on every command, but its much cleaner
PHP Code:
$query = "INSERT INTO `table` VALUES (bla,bla); INSERT INTO `another_Table` VALUES (bla,bla);";
$arr= explode( ';', $query ); foreach( $arr as $command ) { mysql_query( $command ); }
As long as every command is separated with a semi-colon (which is required in regular mysql), it will execute them all.
|
|
|
|