note 79517 deleted from pdostatement.bindparam by danbrown
| From: | danbrown@php.net | Date: | Tue, 17 May 2011 18:10:33 +0000 |
| Subject: | note 79517 deleted from pdostatement.bindparam by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179829@lists.php.net to get a copy of this message | ||
Note Submitter: Sam Bou
----
If you're using bindParam in a loop such as this:
$counter=1;
foreach($email as $val){
$stmt->bindParam($counter, $val, PDO::PARAM_STR);
$counter++;
}
It will fail because $val is local and the variable is bound as a reference and will only be
evaluated at the time that PDOStatement->execute() is called.
So use bindValue instead.