averagejoe77 Posted October 7, 2010 Share Posted October 7, 2010 I am using SMF on my clans website to handle their forums, but I want to create a roster on the main website using the members table from SMF. I can successfully connect to the database and loop through all the names in the table, sorting them by membergroup in descending order. the code is as follows: <?php do { echo '<table border="1" width="90%" style="margin:0 auto 20px auto;" cellspacing="10"> <tr>'; // create a heading based on the member group that a member or members belong too. // i.e. For the Commanding Officer, Unit Staff, Enlisted Personnel, Recruits, and Public Members. // This is where I am lost !!!! echo '</tr> <tr> <th>Rank</th> <th>Name</th> <th></th> </tr> <tr> <td width="10%" valign="middle" align="center">'; $ranks = $row_roster['stars']; $grade = explode("/", $ranks); if ($grade[1] != "") echo '<img src="forums/Themes/25ID20/images/ranks/'.$grade[1].'" /><br />'; echo' </td> <td style="padding-left:30px;">'.$row_roster['member_name'].'</td> <td> </tr> </table>'; } while ($row_roster = mysql_fetch_assoc($roster));?> and the output can be viewed here: Quote http://www.25IDTacOps.com/roster.php As you can see, it creates a separate table for each person in the list. What I want to do is have separate tables for each member group, with all members of one member group in the same table . Currently my member groups are based on the US Army ranking structure, the lower your rank, the lower your member group ID. I cannot for the life of me figure out how to create multiple tables with multiple member names in some tables, and only one member name in other tables. I suppose I could do multiple DB queries, but isn't that a little too redundant? Is what I want possible or am I only hoping? Thanks. Joe. Link to comment https://forums.phpfreaks.com/topic/215320-using-smf-20-rc3-members-and-membergroups-to-create-an-external-roster/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.