1
iHackCode
need help with sql: retreiving a list of users in a group

this is the sql statement i want..
SELECT FROM `xoops2_usersJOIN xoops2_groups_users_link ON xoops2_users.uid xoops2_groups_users_link.uid WHERE xoops2_groups_users_link.groupid '2' AND user_mailok >= '0' AND level '0'


MyCode:
$criteria = new CriteriaCompo();
~~~~~~

if ( !empty(
$_POST['by_group']) && is_numeric($_POST['by_group']) ) {
$criteria->add(new Criteria('JOIN xoops2_groups_users_link ON xoops2_users.uid = xoops2_groups_users_link.uid WHERE xoops2_groups_users_link.groupid'intval($_POST['by_group']), '=',''));
    }

$member_handler =& xoops_gethandler('member');
$total $member_handler->getUserCount($criteria);
~~
$foundusers =& $member_handler->getUsers($criteriatrue);


$total and $foundusers are not working since they both using method that are using the renderWhere() method from the criteria (CriteriaCompo class).. but.. using the render() method will not work either since it also adds parentheses..

.example..
SELECT *FROM `xoops2_usersWHERE (JOIN xoops2_groups_users_link ON xoops2_users.uid xoops2_groups_users_link.uid WHERE xoops2_groups_users_link.groupid '2' AND user_mailok >= '0' AND level '0')


anyone got any ideas on how to make it work?! or a different way to make it work?!
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

2
phppp
Re: need help with sql: retreiving a list of users in a group
  • 2007/3/7 22:20

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


It is not always necessary to use the member handler

Build your own handler if you have much applications with XOOPS users

3
iHackCode
Re: need help with sql: retreiving a list of users in a group

That sounds like a good idea. Thanks.
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

Login

Who's Online

197 user(s) are online (127 user(s) are browsing Support Forums)


Members: 0


Guests: 197


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits