I have a problem with a PDO query. I am trying to update data in an existing DB entry.
This is the SQL query I am using. The missing parameters are passed via the $arguments array.
$sql = "UPDATE user SET vorname = :vorname, nachname = :nachname, plz = :plz, strasse = :strasse, hausnummer = :hausnummer WHERE id= :id"; // SQL to update category
print( "SQL 2: $sql");
The query itself takes place in this function.
function pdo(PDO $pdo, string $sql, array $arguments = null){
if (!$arguments) {
return $pdo->query($sql);
}
$statement = $pdo->prepare($sql);
$statement->execute($arguments);
return $statement;
}
So far it runs error free, but after sending it the entry is not updated.
pdo($pdo, $sql, $arguments);
When I output $sql I see the following....
SQL 2: UPDATE user SET vorname = :vorname, nachname = :nachname, plz = :plz, strasse = :strasse, hausnummer = :hausnummer WHERE id= :id
Does anyone have an idea what I am doing wrong?