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: 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.