U-10 リーグ

“;

$conn = mysql_connect(‘mysql31.heteml.jp’,’_inage2′,’tade2212′) or die(mysql_error());
mysql_select_db(‘_inage2’) or die(mysql_error());

// チーム名取得
$sql = “select * from i_team order by i_team_id”;
$res = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_assoc($res)){
$team_name[$num] = $row[i_team_name];
$num++;
}

// リンクID作成
$list5 .= “

“;
$list5 .= “

 チーム別対戦成績表 

“;
$list5 .= “

“;
$list5 .= “

“;
$list5 .= “

“;
$list5 .= “

“;
$list5 .= “

“.$team_name[1].” “.$team_name[2].” “.$team_name[3].”

“;

// チーム数分ループ
for ($cnt = 1; $cnt <= 3; $cnt++) { $win[$cnt]=0; $lose[$cnt]=0; $draw[$cnt]=0; // チームごとの対戦成績 $list5 .= "

“;
$list5 .= “

“.$team_name[$cnt].” 対戦成績

“;
$list5 .= “

“;
$list5 .= “

“;
$list5 .= “

“;
$list5 .= “

“;
$list5 .= “

“;
$list5 .= “

“;
$list5 .= “

“;

$sql = “select * from i_result where team_id = “.$cnt.” order by team_id,e_id,id;”;
$res = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_assoc($res)){

//順位用集計
$goal[$cnt] = $goal[$cnt] + $row[goal];
$lost[$cnt] = $lost[$cnt] + $row[lost];

// 勝ち点集計
if( $row[result] == 1 ){
$mark_text =”○”;
$point = 3;
$win[$cnt]++;
}
elseif( $row[result] == 2 ){
$mark_text =”●”;
$point = 0;
$lose[$cnt]++;
}
else{
$mark_text =”△”;
$point = 1;
$draw[$cnt]++;
}
$total_point[$cnt] = $total_point[$cnt] + $point;

$list5 .= “

“;
$list5 .= “

“;
$list5 .= “

“;
}
$list5 .= “

対戦チーム スコア 結果 対戦日
“.$team_name[$row[‘e_id’]].” “.$row[‘goal’].” – “.$row[‘lost’].” “.$mark_text.” “.$row[‘game_date’].”

“;
$list5 .= “

“;
}

// 順位データ登録
for($num =1;$num<=3;$num++){ $sql = "update i_rank set point = ".$total_point[$num].", goal = ".$goal[$num].",lost = ".$lost[$num].",sa = ".$goal[$num]." - ".$lost[$num].", win = ".$win[$num].",lose = ".$lose[$num].",draw = ".$draw[$num].",last_date = NOW() WHERE team_id =".$num; $res = mysql_query($sql) or die(mysql_error()); } // 順位表作成 $list0 .= "

“;
$list0 .= “

 2002年組リーグ(U-10) 順位表 

“;
$list0 .= “

“;
$list0 .= “

“;
$list0 .= “

“;
$list0 .= “

“;
$list0 .= “

“;
$list0 .= “

“;
$list0 .= “

“;
$list0 .= “

“;
$list0 .= “

“;
$list0 .= “

“;
$list0 .= “

“;

// 順位データ取得
$sql = “select * from i_rank order by POINT DESC , sa DESC , goal DESC “;
$res = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_assoc($res)){
$list0 .= “

“;
$list0 .= “

“;
$list0 .= “

“;
$list0 .= “

“;
$list0 .= “

“;
}

$list0 .= “

チーム名 勝点
“.$team_name[$row[team_id]].” “.$row[point].” “.$row[win].” “.$row[lose].” “.$row[draw].” “.$row[goal].” “.$row[lost].” “.$row[sa].”

“;

// リーグメンバ表
$list2 .= “

“;
$list2 .= “

 2002年組リーグ(U-10)メンバ表 

“;
$list2 .= “

“;
$list2 .= “

“;
$list2 .= “

“;
$list2 .= “

“;
$list2 .= “

“;
// Team A
$list2 .= “

“;
$list2 .= “

“;
$list2 .= “

“;
$list2 .= “

“;
// Team B
$list2 .= “

“;
$list2 .= “

“;
$list2 .= “

“;
$list2 .= “

“;
// Team C
$list2 .= “

“;
$list2 .= “

“;
$list2 .= “

“;
$list2 .= “

“;
$list2 .= “

チーム名 メンバ
“.$team_name[1].” ヤマト ・ トモヤ ・ ハヤト ・ ハルト ・ ショウ ・ アオト
“.$team_name[2].” ヒカル ・ ケンタロウ ・ダイキ ・ タツキ ・チサト ・ リョウマ ・ ユウマ
“.$team_name[3].” ナオキ ・ アキノリ ・ コウキ ・コウチャン ・ レン ・ ユウナ ・ シュンスケ

“;

$list10 .= ““;

echo $list0;
echo $list2;
echo $list5;
echo $list10;

?>