PDA

View Full Version : Fill Array with members of a usergroup


Nxs
08-08-2006, 11:38 AM
Any pointers on the best way to do this ?

I have a parameter of a single user group value and need to convert this to an array which contains the username of each member who has that group as primary or secondary.

pyro.699
08-08-2006, 11:04 PM
$array = array();
$result = $db->query_read("SELECT * FROM `user` WHERE `usergroupid` = 'X'");
while($row = mysql_fetch_assoc($result))
{
array_push($array, $row['username'])
}
//Output: All the usernams with the usergroupid X
print_r($array);

untested