while ($rowEvt=cased_mysql_fetch_array($events))
{
$round = 4;
while ($round > 1 && !$rowEvt["r".$round."_open"]) $round--;
$format = strict_query("SELECT name, avgtype FROM formats WHERE id=".$rowEvt["r".$round."_format"]);
$avgname = cased_mysql_result($format,0,"name");
$avgtype = cased_mysql_result($format,0,"avgtype");
$cat_id = $rowEvt["id"];
$timetype = $rowEvt["timetype"];
//
IF(!isset($CERTIFICATES))
{
$pdf->SetFont("","B",12);
$pdf->Write(5,$rowEvt["name"]." Podium ($avgname)");
$pdf->Ln();
$pdf->SetFontSize(10);
}
//
$query =
"SELECT $compstable.name, $timestable.average, $timestable.best ".
"FROM $timestable ".
"JOIN $compstable ON ($timestable.comp_id=$compstable.id) ".
"WHERE $timestable.cat_id=$cat_id AND $timestable.round=$round ".
"ORDER BY $timestable.average=\"\", $timestable.average, $timestable.best";
$result = strict_query($query);
$classification = 0;
$count = 0;
$qualified = 3;
$lasta = "";
$lastb = "";
while ($classification<=$qualified && $row=cased_mysql_fetch_array($result))