0
I have the following method for updating
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 receive $params dynamically from an array, as I can traverse this array causing it to fill in the bindValue according to the received array Ex:
for, while ou foreach{
// resultado...
$stmt->bindValue(1,$value);
$stmt->bindValue(2,$value);
}
Opa cool guy, vlws ae helped was not understanding the logic to make this stop there.. I made some changes here and gave right vlw!
– wDrik