【发布时间】:2012-06-17 14:08:07
【问题描述】:
好的,在这里我再次尝试从头开始编写代码,但我无法完全正确...我要做的就是检索用户所在的组 id(不包括注册用户),然后使用在以下语句中:如果检索到的 group_id 是 10,则返回指定的消息,否则从检索到的 group_id 中删除用户并将它们放入 group_id 10。这是我到目前为止所拥有的,但我认为我在某处犯了错误dbal ...至于用户组添加/删除功能,我不确定我是否正确使用它们...我还包括了functions_user.php,但不确定我是否真的需要或是否放置它正确。好吧,这就是我所拥有的,有什么帮助吗?
$integer = 2;
$sql = 'SELECT group_id FROM ' . USER_GROUP_TABLE . '
WHERE user_id = ' . (int) $user->data['user_id'] . "
AND group_id != '" . (int) $integer . "'";
$result = $db->sql_query($sql);
if ($result == 10)
{
$message = sprintf($user->lang['CANNOT_USE_TRAVEL_ITEM'], $this->data['name']);
}
else
{
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
$userid = $user->data['user_id'];
group_user_add((10), array($user_id));
group_user_del(($result), array($user_id));
$message = sprintf($user->lang['TRAVEL_ITEM_NOW_USE'], $this->data['name']);
}
【问题讨论】: