@cyberhopnotic:
Here is the Code that generates the Tournament-View:
Code:
for($i=1; $i<=$numrungs; $i++) {
$DB->query("SELECT m.name, t.timesplayed, t.rungscore, t.mid, t.rung, t.faceoff FROM ibf_tournament_players as t, ibf_members as m WHERE t.tid=".$tid." AND t.rung=".$i." AND m.id=t.mid ORDER BY t.faceoff ASC");
$ctr=0;
$refctr = 0;
while($refctr <= 7) {
$playerinfo[$refctr]['name'] = "";
$playerinfo[$refctr]['timesplayed'] = 0;
$playerinfo[$refctr]['rungscore'] = 0;
$playerinfo[$refctr]['playlink'] = "";
$refctr++;
}
while($row = $DB->fetch_row()) {
if(($ctr == 0 || $ctr == 1) && $row['faceoff'] == 2) {
$ctr = 2;
}
$playerinfo[$ctr]['name'] = $row['name'];
$playerinfo[$ctr]['timesplayed'] = $row['timesplayed'];
$playerinfo[$ctr]['rungscore'] = $row['rungscore'];
if($row['timesplayed'] < 3 && $ibforums->member['id'] == $row['mid']) {
$playerinfo[$ctr]['playlink'] = "<a href='".$ibforums->base_url."act=Arcade&do=playtourney&gameid=".$tinfo['gid']."&tid=$tid&rung=".$row['rung']."'>".$ibforums->lang['play']."</a>";
} else {
$playerinfo[$ctr]['playlink'] = "";
}
$ctr++;
}
$this->output .= $this->define_ladder($i, $playerinfo);
}
I marked the Query+Sorting.
As you see the concept seems to be the problem, as it is sorted by "faceoff" (Match1, Match2 ...) which is ok but is not looking up in which faceoff/Match this player was in the last round ("rung").
I guess this can only be solved by one additional query ...