forked from science-ation/science-ation
52 lines
1017 B
PHP
52 lines
1017 B
PHP
|
<?
|
||
|
function getJudgingTeams()
|
||
|
{
|
||
|
$q=mysql_query("SELECT judges_teams.id,
|
||
|
judges_teams.num,
|
||
|
judges_teams.name,
|
||
|
judges.id AS judges_id,
|
||
|
judges.firstname,
|
||
|
judges.lastname,
|
||
|
judges_teams_link.captain
|
||
|
|
||
|
FROM
|
||
|
judges,
|
||
|
judges_teams,
|
||
|
judges_teams_link
|
||
|
WHERE
|
||
|
judges_teams.year='".$config['FAIRYEAR']."' AND
|
||
|
judges_teams_link.judges_id=judges.id AND
|
||
|
judges_teams_link.judges_teams_id=judges_teams.id
|
||
|
ORDER BY
|
||
|
name,
|
||
|
num,
|
||
|
captain DESC,
|
||
|
lastname,
|
||
|
firstname");
|
||
|
|
||
|
$lastteamid=-1;
|
||
|
$lastteamnum=-1;
|
||
|
echo mysql_error();
|
||
|
$teams=array();
|
||
|
while($r=mysql_fetch_object($q))
|
||
|
{
|
||
|
if($r->id!=$lastteamid)
|
||
|
{
|
||
|
$teams[$r->id]['id']=$r->id;
|
||
|
$teams[$r->id]['num']=$r->num;
|
||
|
$teams[$r->id]['name']=$r->name;
|
||
|
$lastteamid=$r->id;
|
||
|
$lastteamnum=$r->num;
|
||
|
}
|
||
|
$teams[$lastteamid]['members'][]=array(
|
||
|
"id"=>$r->judges_id,
|
||
|
"firstname"=>$r->firstname,
|
||
|
"lastname"=>$r->lastname,
|
||
|
"captain"=>$r->captain
|
||
|
);
|
||
|
}
|
||
|
return $teams;
|
||
|
}
|
||
|
|
||
|
?>
|