If I try to execute it in the MySQL Workbench, it just works. However, it does not work when executet through the php script. I am using MySQLi. The php script throws this Error Message:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELETE FROM admins WHERE id = 2' at line 5
This is the Code from the php file:
function deleteAdmin($connection, $id_admin) {
$sqlStmt = "UPDATE azubis
SET fk_ausbilder = 1
WHERE fk_ausbilder = $id_admin;
DELETE FROM admins
WHERE id = $id_admin";
if (!$connection->query($sqlStmt)) {
echo mysqli_error($connection);
}
closeConnection($connection);
}