dimanche 12 septembre 2021

php function with condiction true in other function

I'm trying to get a record in the 'roles' table to be deleted if the condition checked in another function is true. Even though I'm sure the condition is true I am returning the behavior as if it were false. Thanks for the help you can give me.

function deleteRole($role_id) {
    global $conn;
    if (CanDeleteRole($role_id) == true){
        $sql = "DELETE FROM roles WHERE id=?";
        $result = modifyRecord($sql, 'i', [$role_id]);
        if ($result) {
            $_SESSION['success_msg'] = "Role trashed!!";
            header("location: " . BASE_URL . "admin/roles/roleList.php");
            exit(0);
        }
    }  else {
        $_SESSION['success_msg'] = "Role not trashed!!";
        header("location: " . BASE_URL . "admin/users/userList.php");
    }
}

Aucun commentaire:

Enregistrer un commentaire