Official document https://www.php.net/manual/zh/pdostatement.bindparam.php
Note:
bindParam The second parameter is mixed &$variable is reference by value
Correct usage ($val by reference):
&$val) { $sth->bindParam($key, $val); } ?>
Wrong usage ($val by value, because bindParam needs &$ variable):
$val) { $sth->bindParam($key, $val); }
For more PHP related knowledge, please visitPHP tutorial!
The above is the detailed content of php 踩坑 PDO foreach bindParam. For more information, please follow other related articles on the PHP Chinese website!