2013年3月13日 星期三

取得選定群組的會員名單

取得選定群組的會員名單
foreach ($groups  as $k => $group){
    if($k==0){
      $condition.=" where a.`groupid`='{$group}'";    
    }else{
      $condition.=" or a.`groupid`='{$group}'";
    }
}
$sql = "select a.`uid`,b.`name`,b.`uname`,c.`unit_sn`,d.`name` as group_name,e.`title` from ".$xoopsDB->prefix("groups_users_link")." as a left join ".$xoopsDB->prefix("users")." as b on a.`uid`=b.`uid` left join ".$xoopsDB->prefix("ugm_apply_users")." as c on a.`uid`=c.`uid`  left join ".$xoopsDB->prefix("groups")." as d on a.`groupid`=d.`groupid`  left join ".$xoopsDB->prefix("ugm_apply_unit")." as e on c.`unit_sn`=e.`sn`  {$condition} group by a.`uid` order by a.`uid`";

沒有留言: