prepare("SELECT COUNT(*) FROM inv_equipment WHERE category_id = ?"); $stmt->execute([$id]); $inUse = (int)$stmt->fetchColumn(); if ($inUse > 0) { mnt_json_fail('Impossibile eliminare: la categoria รจ usata da ' . $inUse . ' attrezzature.'); } $pdo->prepare("DELETE FROM inv_categories WHERE id = ?")->execute([$id]); mnt_json_ok(); } catch (Throwable $e) { mnt_json_fail('Errore: ' . $e->getMessage()); }