Index: trunk/install/php/reservecomp.php =================================================================== --- trunk/install/php/reservecomp.php (リビジョン 128) +++ trunk/install/php/reservecomp.php (リビジョン 1) @@ -17,19 +17,4 @@ */ - -include("./foltialib.php"); -$con = m_connect(); - -if ($useenvironmentpolicy == 1){ -if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; -} else { -login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); -} -}//end if login - ?> @@ -44,4 +29,5 @@ fetch(); -if (! $rowdata) { + $query = "select title from foltia_program where tid='$tid'"; + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + + if ($maxrows == 0) { $title = "(未登録)"; }else{ + $rowdata = pg_fetch_row($rs, 0); $title = htmlspecialchars($rowdata[0]); } @@ -86,5 +71,5 @@
-「」を番組予約モードで予約しました。
+「」を番組予約モードで予約しました。

予約スケジュール
@@ -129,10 +114,11 @@ } $rs = m_query($con, $query, "DBクエリに失敗しました"); -$rowdata = $rs->fetch(); -if (! $rowdata) { + $maxrows = pg_num_rows($rs); + + if ($maxrows == 0) { echo("放映予定はいまのところありません
"); } else{ - $maxcols = $rs->columnCount(); + $maxcols = pg_num_fields($rs); ?> @@ -153,11 +139,14 @@ \n"); + /* pg_fetch_row で一行取り出す */ + $rowdata = pg_fetch_row($rs, $row); + for ($col = 0; $col < $maxcols; $col++) { /* 列に対応 */ echo("\n"); } echo("\n"); - } while ($rowdata = $rs->fetch()); + } }//end if ?> @@ -172,31 +161,39 @@ //既存が予約あって、新着が全局予約だったら if ($station ==0){ + $query = " +SELECT + * +FROM foltia_tvrecord +WHERE tid = '$tid' +"; + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + if ($maxrows > 0){ //既存局を消す $query = "DELETE FROM foltia_tvrecord -WHERE tid = ? -"; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); +WHERE tid = '$tid' +"; + $rs = m_query($con, $query, "DBクエリに失敗しました"); + } }//endif $query = " SELECT -count(*) + * FROM foltia_tvrecord -WHERE tid = ? AND stationid = ? -"; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid,$station)); - $maxrows = $rs->fetchColumn(0); +WHERE tid = '$tid' AND stationid = '$station' +"; + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + 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)); + $query = "INSERT INTO foltia_tvrecord values ('$tid','$station','$bitrate')"; + $rs = m_query($con, $query, "DB書き込みに失敗しました"); }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 )); + bitrate = '$bitrate' WHERE tid = '$tid' AND stationid = '$station' + "; + $rs = m_query($con, $query, "DB書き込みに失敗しました"); }
".htmlspecialchars($rowdata[$col])."