note 82677 added to pdostatement.bindparam
| From: | CharlieSmith at osu1 dot php dot net | Date: | Mon, 21 Apr 2008 18:30:07 +0000 |
| Subject: | note 82677 added to pdostatement.bindparam | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138619@lists.php.net to get a copy of this message | ||
$result[] = array(
'storeid' => '1',
'testid' => '101'
);
$result[] = array(
'storeid' => '2',
'testid' => '102'
);
print_r($result);
$row['storeid'] = '9';
$row['testid'] = '900';
$query = 'INSERT INTO pdotest SET storeid = :storeid, testid = :testid';
$statement = $dbconnection->prepare($query);
$statement->bindParam(':storeid',$row['storeid']);
$statement->bindParam(':testid',$row['testid']);
foreach ($result as $row) {
$statement->execute();
}
Will insert 9,900 twice not the intended result of:
1,101
2,102
----
Server IP: 208.69.120.35
Probable Submitter: 204.15.116.78
----
Manual Page -- http://www.php.net/manual/en/pdostatement.bindparam.php
Edit -- https://master.php.net/note/edit/82677
Del: integrated -- https://master.php.net/note/delete/82677/integrated
Del: useless -- https://master.php.net/note/delete/82677/useless
Del: bad code -- https://master.php.net/note/delete/82677/bad+code
Del: spam -- https://master.php.net/note/delete/82677/spam
Del: non-english -- https://master.php.net/note/delete/82677/non-english
Del: in docs -- https://master.php.net/note/delete/82677/in+docs
Del: other reasons-- https://master.php.net/note/delete/82677
Reject -- https://master.php.net/note/reject/82677
Search -- https://master.php.net/manage/user-notes.php