kemper Posted October 23, 2007 Share Posted October 23, 2007 I operate a youth sports website and i display my current alignments in a long running list of teams (one field within my table) with association divisions (another field within table). I would like to group them by divisions, like a two column table for better clarification. Example: Division 1 Division 2 Team 1[br]Team 2[br]Team 3[br]Team 4[br]Team 5 Team 1[br]Team 2[br]Team 3[br]Team 4 [br][br] Division 3 Division 4 Team 1[br]Team 2[br]Team 3[br]Team 4 Team 1[br]Team 2[br]Team 3[br]Team 4[br]Team 5 [br][br] How do I modify my code??? $sql = dbquery( "SELECT ter.*, user_id,user_name FROM s2008_registrations ter LEFT JOIN ".$db_prefix."users tusr ON ter.reg_user=tusr.user_id ORDER BY s08div ASC, team ASC" ); if (dbrows($sql)) { $i = 0; echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'> <tr> <td class='tbl2' width='25%'>Division</td> <td class='tbl2' width='45%'>Team Name</td> </tr>\n"; while ($data = dbarray($sql)) { $i % 2 == 0 ? $tclass="tbl1" : $tclass="tbl2"; echo "<tr> <td class='$tclass' width='25%'><font size='1'>".$data['s08div']."</font></td> <td class='$tclass' width='45%'> <a href='".FUSION_SELF."?step=view&id=".$data['id']."'><font size='1'>".$data['team']."</font></a></td> </tr>\n"; } echo "</table> 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.