What is the difference between PDOStatement::bindParam() and PDOStatement::bindValue()?
From Prepared statements and stored procedures
Use bindParam
to insert multiple rows with one time binding:
prepare("INSERT INTO REGISTRY (name, value) VALUES (?, ?)");
$stmt->bindParam(1, $name);
$stmt->bindParam(2, $value);
// insert one row
$name = 'one';
$value = 1;
$stmt->execute();
// insert another row with different values
$name = 'two';
$value = 2;
$stmt->execute();