Next Matches
<?PHP require_once('/home/sites/heteml/users39/e/s/t/estacion/web/league30/wp-content/themes/icy/define.php'); //$league_id_1 = $league_id1; $league_id_1 = $league_id1; $league_id_2 =""; $league_id_2 = $league_id2; $rank = 1; $sa=1; $i=1; $setsu = $d_setsu; $server = $d_server; $db_id = $d_db_id; $db_pw = $d_db_pw; $div1 = $d_div1; $div2 ="$d_div2"; $date=$d_date; $conn=mysql_connect($server,$db_id,$db_pw) or die(mysql_error()); mysql_select_db($db_id) or die(mysql_error()); // テーブルのヘッダ部作成 // <<<<<< ヘッダ >>>>>>> $info_list .="<p class='top-contents-subtitle'>".$date." 第".$setsu."節</p>"; // <<<<<< 予定表(DIV1) >>>>>>> $info_list .= "<div id='next_match_title'>".$div1."</div>"; $info_list .= "<table class='table-nextmatch-sh'> <tbody> <tr> <td bgcolor=#FFFFFF id='nextschedule_title' width=10% align=center>時間</td> <td bgcolor=#FFFFFF id='nextschedule_title' width=45% colspan=3 align=center>Aピッチ</td> <td bgcolor=#FFFFFF id='nextschedule_title' width=45% colspan=3 align=center>Bピッチ</td> </tr>"; $td_id =""; $a=0; // リーグ情報取得 $sql1 = "select * from `game_result` ,`team` where `game_result`.`league_id`=".$league_id_1." and `game_result`.`setsu` = ".$setsu." and `game_result`.`coat` ='A' and `game_result`.`team_id` = `team`.`id` order by `game_result`.`game_id`"; $res1 = mysql_query($sql1) or die(mysql_error()); while($row = mysql_fetch_assoc($res1)){ $game_time[$a] = $row['time']; $team_a[$a] = $row['team_name_short']; $a++; } $b = 0; $sql1 = "select * from `game_result` ,`team` where `game_result`.`league_id`=".$league_id_1." and `game_result`.`setsu` = ".$setsu." and `game_result`.`coat` ='B' and `game_result`.`team_id` = `team`.`id` order by `game_result`.`game_id`"; $res1 = mysql_query($sql1) or die(mysql_error()); while($row = mysql_fetch_assoc($res1)){ $team_b[$b] = $row['team_name_short']; $b++; } $cnt = 0; $i = 0; foreach( $game_time as $value ){ if($i%2){ $td_id ="nextschedule_list"; } else{ $td_id ="nextschedule_list"; } if(!$game_time[$cnt]){break;} $info_list .= "<tr> <td id=".$td_id." align=center>".$game_time[$cnt]."</td> <td id=".$td_id." align=center>".$team_a[$cnt]."</td> <td id=".$td_id." align=center>-</td> <td id=".$td_id." align=center>".$team_a[$cnt+1]."</td> <td id=".$td_id." align=center>".$team_b[$cnt]."</td> <td id=".$td_id." align=center>-</td> <td id=".$td_id." align=center>".$team_b[$cnt+1]."</td></tr>"; $cnt= $cnt+2; $i++; } $info_list.="</tbody></table>"; // <<<<<< 予定表(右)終了 >>>>>>> if($league_id_2 <>""){ // Group B // $league_id_2 = $league_id2; $rank = 1; $sa=1; $i=1; $team_b=""; // テーブルのヘッダ部作成 // <<<<<< ヘッダ >>>>>>> // <<<<<< 予定表(DIV2) >>>>>>> $info_list .= "<div id='next_match_title' style='margin-top:30px;'>".$div2."</div><table class='table-nextmatch-sh'> <tbody> <tr> <td bgcolor=#FFFFFF id='nextschedule_title' width=10% align=center>時間</td> <td bgcolor=#FFFFFF id='nextschedule_title' width=45% colspan=3 align=center>Aピッチ</td> <td bgcolor=#FFFFFF id='nextschedule_title' width=45% colspan=3 align=center>Bピッチ</td> </tr>"; $td_id =""; $a=0; // リーグ情報取得 $sql1 = "select * from `game_result` ,`team` where `game_result`.`league_id`=".$league_id_2." and `game_result`.`setsu` = ".$setsu." and `game_result`.`coat` ='A' and `game_result`.`team_id` = `team`.`id` order by `game_result`.`game_id`"; $res1 = mysql_query($sql1) or die(mysql_error()); while($row = mysql_fetch_assoc($res1)){ $game_time[$a] = $row['time']; $team_a[$a] = $row['team_name_short']; $a++; } $b = 0; $sql1 = "select * from `game_result` ,`team` where `game_result`.`league_id`=".$league_id_2." and `game_result`.`setsu` = ".$setsu." and `game_result`.`coat` ='B' and `game_result`.`team_id` = `team`.`id` order by `game_result`.`game_id`"; $res1 = mysql_query($sql1) or die(mysql_error()); while($row = mysql_fetch_assoc($res1)){ $team_b[$b] = $row['team_name_short']; $b++; } $cnt = 0; $i = 0; foreach( $game_time as $value ){ if($i%2){ $td_id ="nextschedule_list"; } else{ $td_id ="nextschedule_list"; } if(!$game_time[$cnt]){break;} $info_list .= "<tr> <td id=".$td_id." align=center>".$game_time[$cnt]."</td> <td id=".$td_id." align=center>".$team_a[$cnt]."</td> <td id=".$td_id." align=center>-</td> <td id=".$td_id." align=center>".$team_a[$cnt+1]."</td> <td id=".$td_id." align=center>".$team_b[$cnt]."</td> <td id=".$td_id." align=center>-</td> <td id=".$td_id." align=center>".$team_b[$cnt+1]."</td></tr>"; $cnt= $cnt+2; $i++; } $info_list.="</tbody></table>"; // <<<<<< 予定表(右)終了 >>>>>>> } echo $info_list; ?>
Rank
<?PHP require('/home/sites/heteml/users39/e/s/t/estacion/web/league30/wp-content/themes/icy/define.php'); $league_id_1 = $league_id1; $league_id_2 =""; $league_id_2 = $league_id2; $rank = 1; $sa=1; $i=1; $setsu = $d_setsu; $server = $d_server; $db_id = $d_db_id; $db_pw = $d_db_pw; $div1 = $d_div1; $div2 = $d_div2; $conn=mysql_connect($server,$db_id,$db_pw) or die(mysql_error()); mysql_select_db($db_id) or die(mysql_error()); //******* // DIV1テーブル作成 //******* // テーブルのヘッダ部作成 $rank_list = " <table class='table-colorstripes-rank'> <tr><td colspan='11' style='font-size:18px;text-align:left;background-color:#ffffff;font-weight:bold;padding:10px;'>".$div1."</td></tr> <tr> <td bgcolor=#FFFFFF id='rank_top' width='7%'>順位</td> <td bgcolor=#FFFFFF id='rank_top' width='24%'>チーム</td> <td bgcolor=#FFFFFF id='rank_top' width='9%'>勝点</td> <td bgcolor=#FFFFFF id='rank_top' width='7%'>試合数</td> <td bgcolor=#FFFFFF id='rank_top' width='7%'>勝</td> <td bgcolor=#FFFFFF id='rank_top' width='7%'>分</td> <td bgcolor=#FFFFFF id='rank_top' width='7%'>負</td> <td bgcolor=#FFFFFF id='rank_top' width='7%'>得点—</td> <td bgcolor=#FFFFFF id='rank_top' width='7%'>失点</td> <td bgcolor=#FFFFFF id='rank_top' width='8%'>得失</td> <td bgcolor=#FFFFFF id='rank_top' width='12%'>ファール数</td> </tr>"; //SQL文作成 $sql = "SELECT sum( `game_result`.`point` ) AS POINT, sum( `game_result`.`foul` ) AS FOUL, sum( `game_result`.`goal` ) AS GOAL, sum( `game_result`.`lost` ) AS LOST ,team.team_name,team.id, count(case when `game_result`.`point`=3 then 1 else null end) as WIN , count(case when `game_result`.`point`=0 then 1 else null end) as LOSE , count(case when `game_result`.`point`=1 then 1 else null end) as DROW , count(team_id) as GAME, sum( `game_result`.`goal` )-sum( `game_result`.`lost` ) AS SA FROM game_result,team WHERE `game_result`.`league_id` =".$league_id_1." and `game_result`.`goal` <> -1 and `game_result`.`exivision`<>1 and `game_result`.`team_id` = team.id GROUP BY `team_id` order by POINT desc ,SA desc, GOAL desc"; $res = mysql_query($sql) or die(mysql_error()); $rank = 1; $i=0; while($row = mysql_fetch_assoc($res)){ $sa = $row['GOAL']-$row['LOST']; if($i%2){ $td_id="rank_list"; } else{ $td_id="rank_list"; } $rank_list .="<tr> <td class='rank' id=".$td_id.">".$rank."</td> <td class='team' id=".$td_id."><a href='http://estacion.heteml.jp/league/?page_id=721/#".$row['team_id']."' target='_blank'>".$row['team_name']."</a></td> <td class='no' id=".$td_id.">".$row['POINT']."</td> <td class='no' id=".$td_id.">".$row['GAME']."</td> <td class='no' id=".$td_id.">".$row['WIN']."</td> <td class='no' id=".$td_id.">".$row['DROW']."</td> <td class='no' id=".$td_id.">".$row['LOSE']."</td> <td class='no' id=".$td_id.">".$row['GOAL']."</td> <td class='no' id=".$td_id.">".$row['LOST']."</td> <td class='no' id=".$td_id.">".$sa."</td> <td class='no' id=".$td_id.">".$row['FOUL']."</td> </tr>"; $rank++; $i++; } if($rank==1){ // まだ対戦がない時 $i==1; $sql = "select * from `league-team`,`team` where `league-team`.`league_id` = ".$league_id_1." and `league-team`.`team_id` = `team`.`id` order by `team`.`team_name`"; $res = mysql_query($sql) or die(mysql_error()); while($row=mysql_fetch_array($res,MYSQL_ASSOC)){ if($i%2){ $td_id="rank_list";} else{ $td_id="rank_list";} $rank_list .="<tr> <td class='rank' id=".$td_id.">-</td> <td class='team' id=".$td_id."><a href='http://estacion.heteml.jp/league/?page_id=721/#".$row['team_id']."' target='_blank'>".$row['team_name']."</a></td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> </tr>"; $rank++; $i++; } } $rank_list .="</table>"; //******* // DIV2テーブル作成 //******* // テーブルのヘッダ部作成 if($league_id_2<>""){ $rank_list2 = " <table class='table-colorstripes-rank'> <tr><td colspan='11' style='font-size:18px;text-align:left;background-color:#ffffff;font-weight:bold;padding:10px;'>".$div2."</td></tr> <tr> <td bgcolor=#FFFFFF id='rank_top' width='7%'>順位</td> <td bgcolor=#FFFFFF id='rank_top' width='24%'>チーム</td> <td bgcolor=#FFFFFF id='rank_top' width='9%'>勝点</td> <td bgcolor=#FFFFFF id='rank_top' width='7%'>試合数</td> <td bgcolor=#FFFFFF id='rank_top' width='7%'>勝</td> <td bgcolor=#FFFFFF id='rank_top' width='7%'>分</td> <td bgcolor=#FFFFFF id='rank_top' width='7%'>負</td> <td bgcolor=#FFFFFF id='rank_top' width='7%'>得点—</td> <td bgcolor=#FFFFFF id='rank_top' width='7%'>失点</td> <td bgcolor=#FFFFFF id='rank_top' width='8%'>得失</td> <td bgcolor=#FFFFFF id='rank_top' width='12%'>ファール数</td> </tr>"; //SQL文作成 $sql = "SELECT sum( `game_result`.`point` ) AS POINT, sum( `game_result`.`foul` ) AS FOUL, sum( `game_result`.`goal` ) AS GOAL, sum( `game_result`.`lost` ) AS LOST ,team.team_name,team.id, count(case when `game_result`.`point`=3 then 1 else null end) as WIN , count(case when `game_result`.`point`=0 then 1 else null end) as LOSE , count(case when `game_result`.`point`=1 then 1 else null end) as DROW , count(team_id) as GAME, sum( `game_result`.`goal` )-sum( `game_result`.`lost` ) AS SA FROM game_result,team WHERE `game_result`.`league_id` =".$league_id_2." and `game_result`.`goal` <> -1 and `game_result`.`exivision`<>1 and `game_result`.`team_id` = team.id GROUP BY `team_id` order by POINT desc ,SA desc, GOAL desc"; $res = mysql_query($sql) or die(mysql_error()); $rank = 1; $i=0; while($row = mysql_fetch_assoc($res)){ $sa = $row['GOAL']-$row['LOST']; if($i%2){ $td_id="rank_list"; } else{ $td_id="rank_list"; } $rank_list2 .="<tr> <td class='rank' id=".$td_id.">".$rank."</td> <td class='team' id=".$td_id.">".$row['team_name']."</td> <td class='no' id=".$td_id.">".$row['POINT']."</td> <td class='no' id=".$td_id.">".$row['GAME']."</td> <td class='no' id=".$td_id.">".$row['WIN']."</td> <td class='no' id=".$td_id.">".$row['DROW']."</td> <td class='no' id=".$td_id.">".$row['LOSE']."</td> <td class='no' id=".$td_id.">".$row['GOAL']."</td> <td class='no' id=".$td_id.">".$row['LOST']."</td> <td class='no' id=".$td_id.">".$sa."</td> <td class='no' id=".$td_id.">".$row['FOUL']."</td> </tr>"; $rank++; $i++; } if($rank==1){ // まだ対戦がない時 $i==1; $sql = "select * from `league-team`,`team` where `league-team`.`league_id` = ".$league_id_2." and `league-team`.`team_id` = `team`.`id` order by `team`.`team_name`"; $res = mysql_query($sql) or die(mysql_error()); while($row=mysql_fetch_array($res,MYSQL_ASSOC)){ if($i%2){ $td_id="rank_list";} else{ $td_id="rank_list";} $rank_list2 .="<tr> <td class='rank' id=".$td_id.">-</td> <td class='team' id=".$td_id.">".$row['team_name']."</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> <td class='no' id=".$td_id.">0</td> </tr>"; $rank++; $i++; } } $rank_list2 .="</table>"; } $result = "<div style='margin-bottom:50px;'>".$rank_list."</div><div>".$rank_list2."</div>"; echo $result; ?>