making an active roster list

Hi,

I’m trying to take the different groups from a database (phpbb3). and create a list for each of the clans sections.

Admin group_id = 5
staff group_id = 12
members group_id = 16

I can get it to take the info from one group, but trying to take it from 2 groups I get no output (white page). If you could give me pointers on where i’m going wrong.

[php]// query for clan admins
$resulta = mysql_query(“SELECT username FROM phpbb_users WHERE group_id=‘5’”);
while ($row1 = mysql_fetch_array($resulta))
{
list($username) = $row1;
echo "[UKE]$username, ";
}

[/php]

if I add in another but chaning the $resulta and $row1 i get nothing

Your mysql query says take it from group 5 only try adding this to the end of the query.

[php]group_id=‘5’ AND group_id=‘12’[/php]

yea that brings them all out in one line, but with me having a few special groups I need to seperate them on the roster. hence the need for different queries

Separate queries or use php

[size=10pt]PHP way[/size]
[php]
// query for clan admins
$resulta = mysql_query("SELECT username,group_id FROM phpbb_users WHERE group_id=‘5’ AND group_id=‘12’ AND group_id=‘16’ ");
while ($row1 = mysql_fetch_array($resulta)) {
list($username) = $row1;

if($row1[‘group_id’]==‘5’ ){
echo "[UKE]$username, ";
} else
if($row1[‘group_id’]==‘12’ ){
echo "[UKE]$username, ";
} else
if($row1[‘group_id’]==‘16’ ){
echo "[UKE]$username, ";
}
}


[/php]

[size=12pt]Separtate queries[/size]
[php]
// query for clan admins
$resulta = mysql_query(“SELECT username FROM phpbb_users WHERE group_id=‘5’”);
while ($row1 = mysql_fetch_array($resulta)) {
list($username) = $row1;
echo "[UKE]$username, ";
}


[/php]

[php]
// query for clan admins
$resulta = mysql_query(“SELECT username FROM phpbb_users WHERE group_id=‘12’”);
while ($row1 = mysql_fetch_array($resulta)) {
list($username) = $row1;
echo "[UKE]$username, ";
}


[/php]

[php]
// query for clan admins
$resulta = mysql_query(“SELECT username FROM phpbb_users WHERE group_id=‘16’”);
while ($row1 = mysql_fetch_array($resulta)) {
list($username) = $row1;
echo "[UKE]$username, ";
}


[/php]

tryed both way, and was having problems, took out the
and seemed to output info on my first file. So working on trying to get it to look right.

Got the list fully done, with all groups showing as I liked. basically this should save me time updating a manual roster page of new clan members.

If there is anyone wishing this page, let me know i’ll add the code can be used for any clans that use phpbb3 forums, or basis of it could be used for all forums with the right tweaks.

And thanks for the pointers, they got me there finally.

Sponsor our Newsletter | Privacy Policy | Terms of Service