This function needs to update the database, but it is not working I also try'd bindValue...what am I missing here?
the values are consisting of an array with arrays like this:
$values = array(array($key => $value ),etc );
function:
public function dbUpdateKey($table, $pk, $id,$values)
{
$this->conn();
$sql = "UPDATE `$table` SET waarde = :value WHERE `$pk` = $id AND sleutel = :key";
$stmt = $this->db->prepare($sql);
foreach($values as $vals)
{
$stmt->bindParam(':key', $vals[0], PDO::PARAM_STR);
$stmt->bindParam(':value', $vals[1], PDO::PARAM_STR);
$ret = $stmt->execute();
}
}
EDIT:
fixed it values array should have been one dimensional (a comma instead of => )
$values = array(array($key, $value ),etc );
thanks, Richard