I have the following method for update
public function update($params, $id)
{
$params_fields = "'".implode("'= ?, '", array_keys($params))."'= ?";
$query = "UPDATE '{$this->table}' SET {$params_fields}, WHERE 'id'=:id";
$stmt = $this->db->prepare($query);
$stmt->bindValue(":id", $id);
// Aqui esta a dúvida
$stmt->bindValue(?,$value);
//$stmt->execute();
return $query;
}
I get $ params dynamically from an array, how can I go through this array by having it fill the bindValue according to the received array Ex:
for, while ou foreach{
// resultado...
$stmt->bindValue(1,$value);
$stmt->bindValue(2,$value);
}