Jump to content

Ranking System


Jay2391

Recommended Posts

I have 4 teams

Ranks 1 thru 4 and this number could change to 8, 16, ect....

So i set up a code that tells me the number of teams and ranks them example ...4 teams

but I want to display them like this .... the condiction is that it display them based on the number of teams...

and remember they can't change..


Rank 1
Rank 4
<br>
Rank 3
Rank 2

my logic....
$lownum = lowes number (1)
$highnum = highest number (4)

Echo
$lownum
$highnum
<br>
$lownum+1
$highnum -1

the issue is that as i increase the number of teams i do not know how to select them???


Link to comment
https://forums.phpfreaks.com/topic/35537-ranking-system/
Share on other sites

Okay i am a genius here is the code

    $b_query = "SELECT * FROM $tabler WHERE (tourney_name=\"$tourney\")ORDER By 'rank' ";
    $b_result = mysql_query($b_query);    
while($b_row = mysql_fetch_array($b_result)){
$count = $count + 1;
        }
        $total_teams = $count;
        $open_teams = $max_teams - $count;
$total_games = $count / 2;

echo "<br>Open Spots: $open_teams";
echo "<br>Total Teams: $total_teams";
echo "<br>Total Games: $total_games";

print "<br><br><p><h5>Schedule Games and Times:</h5></p>";
   
$b2_query = "SELECT * FROM $tabler WHERE (tourney_name=\"$tourney\")ORDER By 'rank'";
    $b2_result = mysql_query($b2_query);

print "<br><p>Round:</p>";
while($b2_row = mysql_fetch_array($b2_result)){
  if($total_games != 0){    
$b2_rank= $b2_row['rank'];
$b2_user_name = $b2_row['user_name'];

$b3_query = "SELECT * FROM $tabler WHERE (rank=\"$total_teams\")";
            $b3_result = mysql_query($b3_query);
                $b3_row = mysql_fetch_array($b3_result);
 
    $b3_rank= $b3_row['rank'];
    $b3_user_name = $b3_row['user_name'];
   
print "<p>$b2_rank - $b2_user_name</p>";
print "<p>$b3_rank - $b3_user_name</p>";
       
$total_games = $total_games -1;
$total_teams = $total_teams -1;        
       
   
      if($total_games == 0){
          echo "Bracket Completed!!!";
          }
  }
        }
Link to comment
https://forums.phpfreaks.com/topic/35537-ranking-system/#findComment-168271
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.