"; echo "路線番号:".$route_data[0]['r_id']."
"; echo "路線名:".$route_data[0]['r_name']."
"; echo "ルート色:".$route_data[0]['r_color']."
"; echo "運休日等:".$route_data[0]['suspension_day']."
"; echo "備考1:".$route_data[0]['remarks']."
"; echo "備考2:".$route_data[0]['remarks2']."
"; echo "備考3:".$route_data[0]['remarks3']."
"; } /*------------------------------------------*/ /*------------路線データの抽出------------*/ $con=@mysql_connect("localhost","event","L523GpA"); if(!$con){ unset($con,$data,$r_id,$lat,$lng,$time,$day); die("DB接続エラー"); } $select_db=@mysql_select_db("eventdb"); if(!$select_db){ unset($con,$select_db,$r_id,$lat,$lng,$time,$day); die ("DB選択エラー"); } @mysql_query("set names utf8"); $sql="select * from nservice_name_tbl where r_id=".$r_id." order by busservice_id asc"; $res = mysql_query($sql); if($_GET['debug']==1){ echo "

便に関するデータ
"; } for($i = 0;$row = mysql_fetch_array($res);$i++){ $service_id[$i]=$row['busservice_id']; $service_name[$i]=$row['busservice_name']; $backcolor[$i]=$row['backcolor']; if($_GET['debug']==1){ echo $service_id[$i]."
"; echo $service_name[$i]."
"; echo $backcolor[$i]."
"; } } $max_service=$i;//便数の最大値 mysql_free_result($res); $close=@mysql_close($con); if(!$close){ unset($con,$select_db,$res,$sql,$row,$close,$r_id,$lat,$lng,$time,$day); die("DB切断エラー"); } unset($con,$select_db,$res,$sql,$row,$close); /*------------------------------------------*/ /*------------バス停データの抽出------------*/ $con=@mysql_connect("localhost","event","L523GpA"); if(!$con){ unset($con,$data,$r_id,$lat,$lng,$time,$day); die("DB接続エラー"); } $select_db=@mysql_select_db("eventdb"); if(!$select_db){ unset($con,$select_db,$r_id,$lat,$lng,$time,$day); die ("DB選択エラー"); } @mysql_query("set names utf8"); $sql="select bus_name from nbus_master where r_id=".$r_id." order by busstop_id asc"; $res = mysql_query($sql); if($_GET['debug']==1){ echo "

バス停に関するデータ
"; } for($i = 0;$row = mysql_fetch_array($res);$i++){ $bus_name[$i]=$row['bus_name']; if($_GET['debug']==1){ echo $bus_name[$i]."
"; } } mysql_free_result($res); $close=@mysql_close($con); if(!$close){ unset($con,$select_db,$res,$sql,$row,$close,$r_id,$lat,$lng,$time,$day); die("DB切断エラー"); } unset($con,$select_db,$res,$sql,$row,$close); /*------------------------------------------*/ /*------------時刻データの抽出------------*/ $con=@mysql_connect("localhost","event","L523GpA"); if(!$con){ unset($con,$data,$r_id,$lat,$lng,$time,$day); die("DB接続エラー"); } $select_db=@mysql_select_db("eventdb"); if(!$select_db){ unset($con,$select_db,$r_id,$lat,$lng,$time,$day); die ("DB選択エラー"); } @mysql_query("set names utf8"); $sql="select time from ntime_tbl where r_id=".$r_id." order by busstop_id,busservice_id asc"; $res = mysql_query($sql); if($_GET['debug']==1){ echo "

時刻に関するデータ
"; } $service=0; $busstop_id=0; for($i = 0;$row = mysql_fetch_array($res);$i++){ $time[$busstop_id][$service]=$row['time']; // echo $busstop_id.":".$service.":".$time[$busstop_id][$service]."
"; $service++; if($service % $max_service==0){ $busstop_id++; $service=0; } } if($_GET['debug']==1){ echo $busstop_id."
"; } mysql_free_result($res); $close=@mysql_close($con); if(!$close){ unset($con,$select_db,$res,$sql,$row,$close,$r_id,$lat,$lng,$time,$day); die("DB切断エラー"); } unset($con,$select_db,$res,$sql,$row,$close); /*------------------------------------------*/ ?> "); print("
  ".$route_data[0]['r_name']."   ".$route_data[0]['suspension_day']."


"); print(""); print(""); print(""); print(""); for($i=0;$i<$max_service;$i++){ if($i==3 && $r_id==9){ print(""); }else{ print(""); } } print(""); print(""); for($i=0;$i<$busstop_id;$i++){ print(""); print(""); print(""); for($j=0;$j<$max_service;$j++){ if($j==3 && $r_id==9){ $time_array=explode(",", $time[$i][$j]); print(""); print(""); }else{ print(""); } } print(""); } print("
 
停留所
$service_name[$i]
$service_name[$i]
".($i+1)."
$bus_name[$i]
".$time_array[0]."
".$time_array[1]."
".$time[$i][$j]."
"); print("

".$route_data[0]['remarks']."
".$route_data[0]['remarks2']."
".$route_data[0]['remarks3']."
"); ?>