Revision: 24091
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 20, 2010 19:20 by atma
Initial Code
$pdo->beginTransaction(); //... $stmt = $pdo->prepare('INSERT INTO foo VALUES(:v1_1, :v1_2, :v1_3), (:v2_1, :v2_2, :v2_3), (:v2_1, :v2_2, :v2_3)'); $stmt->bindValue(':v1_1', $data[0][0]); $stmt->bindValue(':v1_2', $data[0][1]); $stmt->bindValue(':v1_3', $data[0][2]); //... $stmt->execute(); //or $stmt = $pdo->prepare('INSERT INTO foo VALUES(:a, :b, :c)'); foreach($data as $item) { $stmt->bindValue(':a', $item[0]); $stmt->bindValue(':b', $item[1]); $stmt->bindValue(':c', $item[2]); $stmt->execute(); } //... $pdo->commit();
Initial URL
Initial Description
Initial Title
PDO multiple inserts
Initial Tags
mysql
Initial Language
PHP