I have an array which relates mysql-colums to PDO datatypes:
$imp->datafields=array(
"id" => "PARAM_INT",
"name" => "PARAM_STR",
"cookieLength" => "PARAM_INT"
);
I want to bind these parameters using foreach()
foreach($imp->datafields AS $key => $value) {
$stmt->bindParam(':$key', $program->$key, PDO::$value);
}
and get this error:
PHP Fatal error: Access to undeclared static property: PDO::$value
How can I solve this problem?