function deleteRoles() { global $db, $id; $appuserroleDAO = new AppuserroleDAO($db); foreach ($appuserroleDAO->findByUser_id($id) as $rolerow) { $appuserroleDAO->delete($rolerow->id); } }