Index: trunk/install/php/reservecomp.php =================================================================== --- trunk/install/php/reservecomp.php (リビジョン 83) +++ trunk/install/php/reservecomp.php (リビジョン 94) @@ -67,12 +67,11 @@ //タイトル取得 - $query = "select title from foltia_program where tid='$tid'"; - $rs = m_query($con, $query, "DBクエリに失敗しました"); - $maxrows = pg_num_rows($rs); - - if ($maxrows == 0) { + $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{ - $rowdata = pg_fetch_row($rs, 0); $title = htmlspecialchars($rowdata[0]); } @@ -130,11 +129,10 @@ } $rs = m_query($con, $query, "DBクエリに失敗しました"); - $maxrows = pg_num_rows($rs); - - if ($maxrows == 0) { +$rowdata = $rs->fetch(); +if (! $rowdata) { echo("放映予定はいまのところありません
"); } else{ - $maxcols = pg_num_fields($rs); + $maxcols = $rs->columnCount(); ?> @@ -155,14 +153,11 @@ \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 ?> @@ -177,38 +172,31 @@ //既存が予約あって、新着が全局予約だったら 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 = '$tid' -"; - $rs = m_query($con, $query, "DBクエリに失敗しました"); - } +WHERE tid = ? +"; +// $rs = m_query($con, $query, "DBクエリに失敗しました"); + $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); }//endif $query = " SELECT - * +count(*) FROM foltia_tvrecord -WHERE tid = '$tid' AND stationid = '$station' -"; - $rs = m_query($con, $query, "DBクエリに失敗しました"); - $maxrows = pg_num_rows($rs); - +WHERE tid = ? AND stationid = ? +"; +// $rs = m_query($con, $query, "DBクエリに失敗しました"); + $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid,$station)); + $maxrows = $rs->fetchColumn(0); if ($maxrows == 0) { //新規追加 - $query = "INSERT INTO foltia_tvrecord values ('$tid','$station','$bitrate','$usedigital')"; - $rs = m_query($con, $query, "DB書き込みに失敗しました"); + $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 = '$bitrate' , digital = '$usedigital' WHERE tid = '$tid' AND stationid = '$station' "; - $rs = m_query($con, $query, "DB書き込みに失敗しました"); + bitrate = ? , digital = ? WHERE tid = ? AND stationid = ? "; +// $rs = m_query($con, $query, "DB書き込みに失敗しました"); + $rs = sql_query($con, $query, "DB書き込みに失敗しました",array( $bitrate, $usedigital , $tid , $station )); }
".htmlspecialchars($rowdata[$col])."