66
Mith -
The following code is how I get the group IDs:
$core_table = $xoopsDB->prefix('groups');
$mod_table = $xoopsDB->prefix('xcmg_usergroups');
// Build comma-delimited list of group PK's that are in core groups table.
$sql = "SELECT groupid FROM $core_table WHERE 1";
$result = $xoopsDB->query($sql);
while ($row = $xoopsDB->fetchArray($result))
{
$core_groupids .= $row['groupid'] . ",";
}
$core_groupids = substr($core_groupids, 0, -1);
$xoopsDB->freeRecordSet($result);
// Delete module groups that do not exist in the core groups table.
$sql = "DELETE FROM $mod_table WHERE group_id NOT IN ($core_groupids)";
$result = $xoopsDB->query($sql);
Pardon me for being dense on this subject but...
(1) How would I use a POST method for accomplishing what I'm attempting to do?
(2) What, regarding security, should I be looking at if I decide to use db::queryF instead? As this code is not using any outside variables, is it safe?
(3) I assume using a POST method and db::query is the preferred way of executing a delete query, correct?
Thanks for your help Mith!
It's only a matter of time before I get my head fully around PHP and Xoops. Between the help you and Dave are giving me, I hope to get there sooner than later.
Brad