Jump to content

Recommended Posts

Here is the sample page:

http://hoosierhoopsreport.com/pg-test/

 

Trying to create a table that has three sections (groupings).  That part I have figured out.  The first grouping is sorted numerically.  The second group is sorted alphabetically based on what part of the state they live in.  It's breaking down this second part that I can't seem to get.  (The third group is just what's left over, sorted alphabetically.)

 

So it needs to look like this:  (Each group and region have their own header row.  Only Group 2 is broken down into Regions.)

 

Group 1

Group 2

-Region 1

-Region 2

-Region 3

-Region 4

-Region 5

Group 3

 

The sample page above, in Group 2, it just shows Region 1 header. 

 

$query = 'SELECT * FROM a_playerRank WHERE year="2015" and position="1" ORDER BY grouping DESC,rankPos,region,nameLast';
$results = mysql_query($query) or trigger_error('MySQL error: ' . mysql_error());

$currentGrouping = false; 
$currentRegion = false;

while($line = mysql_fetch_assoc($results)) {

    if($currentGrouping != $line['grouping'])
        {
            //Status has changed, display status header

            $currentGrouping = $line['grouping'];

		if($line['grouping']==2)  {

				echo '<thead>
				<tr>
				<th class="num">#</th>
				<th class="top">Top 10</th>
				<th class="height">HT</th>';

				if (current_user_can("access_s2member_level4")){
				echo '<th class="level">Level</th>';
				}
				echo'
				<th class="school">City (School)</th>';

				if (current_user_can("access_s2member_level4")){
				echo '<th class="summer">Summer Team</th>';
				}
				echo'
				<th class="college">College</th>
				</tr>
				</thead>';
			}

		if($line['grouping']==1) {echo '<tr><th colspan="7">Best of the Rest</th></tr>';


			if($currentRegion != $line['region'])
				{
					$currentRegion = $line['region'];

				echo '<tr><th colspan="7">Region' .$line['region'] . '</th></tr>';}			


		}

		if($line['grouping']==0) echo '<tr><th colspan="7">Names to Know</th></tr>';

	}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.