I am trying to pass the parameter constraint to PDO from an array i.e.
public function write($sql,$bindparams=''){
try{
$stmt = $this->db_connection->prepare($sql);
if($bindparams != '' && is_array($bindparams)){
foreach($bindparams as $k){
$b = $k[0]; //parameter to bind to
$v = $k[1]; //the value
$c = $k[2]; //the parameter constraint(i.e. PDO::PARAM_STR)
$stmt->bindParam($b,$v,$c);
}
$stmt->execute();
}
}
catch(PDOException $e){
echo 'Error acquiring data: '.$e->getMessage();
exit();
}
}
However, it seems to choke - if I pass it the constant, the function recieves integers, and it won't accept a string description