prepare("UPDATE candidates SET approved = NOT approved WHERE id = ?"); $stmt->execute([$id]); $stmt = $pdo->prepare("SELECT position_id FROM candidates WHERE id = ?"); $stmt->execute([$id]); $pos_id = $stmt->fetchColumn(); audit_log('Toggled candidate approval', 'candidates', $id); header("Location: ../manage_candidates.php?position_id=$pos_id&success=1"); exit; } catch (Exception $e) { die($e->getMessage()); } }