prepare("SELECT is_active FROM products WHERE id = ?"); $stmt->execute([$id]); $current_status = $stmt->fetchColumn(); if ($current_status === false) { die("Produkt nie znaleziony."); } // Flip the status $new_status = $current_status ? 0 : 1; $update_stmt = $pdo->prepare("UPDATE products SET is_active = ? WHERE id = ?"); $update_stmt->execute([$new_status, $id]); header("Location: products.php"); exit;