I had a loop like that :
foreach($Fields as $Name => $Value){
$Query->bindParam(\':\'.$Name, $Value, PDO::PARAM_STR);
}
Nothing c
However, thanks to this guys. I found out that you need to pass the value by reference with a & before like that :
foreach($Fields as $Name => &$Value){
$Query->bindParam(':'.$Name, $Value, PDO::PARAM_STR);
}
This was driving me nuts.
Actual quote from PHP.net :
Vili 28-May-2010 12:01
This works ($val by reference):
&$val){
$sth->bindParam($key, $val);
}
?>
This will fail ($val by value, because bindParam needs &$variable):
$val) {
$sth->bindParam($key, $val);
}
?>