prepare("SELECT file_path FROM profile_pictures WHERE user_id = :id"); $stmt->execute([':id' => $userId]); $user = $stmt->fetch(PDO::FETCH_ASSOC); if($user && !empty($user['file_path'])){ $file_Path = "../" . $user['file_path']; if(file_exists($file_Path)){ unlink($file_Path); } $stmt = $pdo->prepare("DELETE FROM profile_pictures WHERE user_id = :id"); $stmt->execute([':id' => $userId]); } header("Location: ../index.php"); exit; ?>