");
		}
$station = getgetnumform(station);
		if ($station == "") {
		$station = 0;
		}
$usedigital = getgetnumform(usedigital);
		if ($usedigital == "") {
		$usedigital = 0;
		}
$bitrate = getgetnumform(bitrate);
		if ($bitrate == "") {
		$bitrate = 5;
		}
$now = date("YmdHi");   
//タイトル取得
	$query = "select title from foltia_program where tid = ? ";
//	$rs = m_query($con, $query, "DBクエリに失敗しました");
	$rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid));
$rowdata = $rs->fetch();
if (! $rowdata) {
		$title = "(未登録)";
		}else{
		$title = htmlspecialchars($rowdata[0]);
		}
?>
  予約完了
  
「=$title?>」を番組予約モードで予約しました。 
 
予約スケジュール 
=  '$now'  AND foltia_program.tid ='$tid' 
ORDER BY foltia_subtitle.startdatetime  ASC
";
}else{
//全局
	$query = "
SELECT 
foltia_subtitle.pid ,  
stationname,
foltia_subtitle.countno,
foltia_subtitle.subtitle,
foltia_subtitle.startdatetime ,
foltia_subtitle.lengthmin ,
foltia_subtitle.startoffset 
FROM foltia_subtitle , foltia_program ,foltia_station  
WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 
 AND foltia_subtitle.startdatetime >=  '$now'  AND foltia_program.tid ='$tid' 
ORDER BY foltia_subtitle.startdatetime  ASC
";
}
	$rs = m_query($con, $query, "DBクエリに失敗しました");
$rowdata = $rs->fetch();
if (! $rowdata) {
		echo("放映予定はいまのところありません
");
		}
		else{
	$maxcols = $rs->columnCount();
?>
  
	
		
			| PID | 放映局 | 話数 | サブタイトル | 開始時刻 | 総尺 | 時刻ずれ | 
	
	
		\n");
				for ($col = 0; $col < $maxcols; $col++) { /* 列に対応 */
					echo("".htmlspecialchars($rowdata[$col])." \n");
				}
				echo("\n");
       } while ($rowdata = $rs->fetch());
		}//end if
		?>
 | 
fetchColumn(0);
		if ($maxrows == 0) { //新規追加
				$query = "INSERT INTO  foltia_tvrecord  values (?,?,?,?)";
//				$rs = m_query($con, $query, "DB書き込みに失敗しました");
				$rs = sql_query($con, $query, "DB書き込みに失敗しました",array($tid,$station,$bitrate,$usedigital));
		}else{//修正 (ビットレート)
			$query = "UPDATE  foltia_tvrecord  SET 
  bitrate = ? , digital = ? WHERE tid = ? AND stationid = ? ";
//			$rs = m_query($con, $query, "DB書き込みに失敗しました");
			$rs = sql_query($con, $query, "DB書き込みに失敗しました",array( $bitrate, $usedigital , $tid , $station ));
		}
	
//キュー入れプログラムをキック
//引数 TID チャンネルID
//echo("$toolpath/perl/addatq.pl $tid $station");
$oserr = system("$toolpath/perl/addatq.pl $tid $station");
}//end if demomode
?>