note 85162 deleted from pdostatement.bindparam by danbrown
| From: | danbrown@php.net | Date: | Tue, 17 May 2011 18:09:40 +0000 |
| Subject: | note 85162 deleted from pdostatement.bindparam by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179826@lists.php.net to get a copy of this message | ||
Note Submitter: chance garcia
----
@charlie smith
That behavior is expected since you are binding named parameters outside of your loop. to achieve
your desired results:
<?php
$query = 'INSERT INTO pdotest SET storeid = :storeid, testid = :testid';
$statement = $con->prepare($query);
foreach ($result as $row) {
$statement->bindParam(':storeid',$row['storeid']);
$statement->bindParam(':testid',$row['testid']);
$statement->execute();
}
?>