exec($SQL['create1']); // Insert using question mark placeholders $stmt = $DB->prepare($SQL['insert1']); foreach ($data as $row) { $stmt->execute($row); } $select = $DB->query($SQL['select']); $num = $select->fetchColumn(); echo 'There are ' . $num . " rows in the table.\n"; // Insert using named parameters $stmt2 = $DB->prepare($SQL['insert2']); foreach ($data as $row) { $stmt2->execute(array(':first'=>($row[0] + 5), ':second'=>$row[1], ':third'=>$row[2])); } $select = $DB->query($SQL['select']); $num = $select->fetchColumn(); echo 'There are ' . $num . " rows in the table.\n"; ?>