prepare("INSERT INTO item_groups (groupName, sortOrder) VALUES (?,?)")->execute([$name, $order]); flash('success', "Group '$name' added."); } else { flash('error', 'Name required.'); } } if ($action === 'edit') { $id = (int)$_POST['groupID']; $name = trim($_POST['groupName'] ?? ''); $order = (int)($_POST['sortOrder'] ?? 0); if ($name !== '') { $pdo->prepare("UPDATE item_groups SET groupName=?,sortOrder=? WHERE groupID=?")->execute([$name,$order,$id]); flash('success', 'Group updated.'); } else { flash('error', 'Name required.'); } } if ($action === 'delete') { $id = (int)$_POST['groupID']; $pdo->prepare("DELETE FROM item_groups WHERE groupID=?")->execute([$id]); flash('success', 'Group deleted.'); } header('Location: item_groups.php'); exit; } $groups = $pdo->query("SELECT * FROM item_groups ORDER BY sortOrder, groupID")->fetchAll(); admin_head('Item Groups', 'item_groups.php'); show_alerts(); ?>

Item Groups

Add New Group

prepare("SELECT COUNT(*) FROM items WHERE groupID=?"); $stmt->execute([$g['groupID']]); $cnt = $stmt->fetchColumn(); $id = $g['groupID']; ?>
#NameSortItems