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();
?>
".htmlspecialchars($rowdata[$col])." | \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 ));
}
Index: trunk/install/php/folcast.php
===================================================================
--- trunk/install/php/folcast.php (リビジョン 70)
+++ trunk/install/php/folcast.php (リビジョン 94)
@@ -51,5 +51,5 @@
$query = "
SELECT foltia_program.tid,foltia_program.title,
-foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" ~~ 'M%%' AND foltia_program.tid = foltia_subtitle.tid AND foltia_program.tid = $tid
+foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" LIKE 'M%%' AND foltia_program.tid = foltia_subtitle.tid AND foltia_program.tid = $tid
ORDER BY \"enddatetime\" DESC
offset 0 limit $max
@@ -59,8 +59,9 @@
SELECT foltia_program.tid,foltia_program.title
FROM foltia_program
-WHERE foltia_program.tid = $tid
+WHERE foltia_program.tid = ?
";
- $titlers = m_query($con, $query, "DBクエリに失敗しました");
- $rowdata = pg_fetch_row($titlers, 0);
+// $titlers = m_query($con, $query, "DBクエリに失敗しました");
+ $titlers = sql_query($con, $query, "DBクエリに失敗しました",array($tid));
+ $rowdata = $titlers->fetch();
$rsstitle = $rowdata[1];
}else{
@@ -68,6 +69,6 @@
$query = "
SELECT foltia_program.tid,foltia_program.title,
-foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" ~~ 'M%%' AND foltia_program.tid = foltia_subtitle.tid ORDER BY \"enddatetime\" DESC
-offset 0 limit $max
+foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" LIKE 'M%%' AND foltia_program.tid = foltia_subtitle.tid ORDER BY \"enddatetime\" DESC
+offset 0 limit ?
";
$rsstitle = "新規録画";
@@ -96,14 +97,12 @@
print $header;
- $rs = m_query($con, $query, "DBクエリに失敗しました");
- $maxrows = pg_num_rows($rs);
+// $rs = m_query($con, $query, "DBクエリに失敗しました");
+ $rs = sql_query($con, $query, "DBクエリに失敗しました",array($max));
+$rowdata = $rs->fetch();
-if ($maxrows == 0) {
+if (! $rowdata) {
//die_exit("No items");
}else{
-
-for ($row = 0; $row < $maxrows; $row++) {
- $rowdata = pg_fetch_row($rs, $row);
-
+ do {
//$title = mb_convert_encoding($rowdata[1],"UTF-8", "EUC-JP");
$tid = $rowdata[0];
@@ -163,5 +162,5 @@
print $item ;
-}//for
+ } while ($rowdata = $rs->fetch()); //do
}//if
Index: trunk/install/php/m.php
===================================================================
--- trunk/install/php/m.php (リビジョン 83)
+++ trunk/install/php/m.php (リビジョン 94)
@@ -97,12 +97,9 @@
SELECT stationname
FROM foltia_station
-WHERE stationid = $recstid";
- $stationvalid = m_query($con, $query, "DBクエリに失敗しました");
- $stationcount = pg_num_rows($stationvalid);
-
- if ($stationcount == 1){
- $recstationname = pg_fetch_row($stationvalid, 0);
- //valid
- }else{
+WHERE stationid = ? ";
+// $stationvalid = m_query($con, $query, "DBクエリに失敗しました");
+ $stationvalid = sql_query($con, $query, "DBクエリに失敗しました",array($recstid));
+ $recstationname = $stationvalid->fetch();
+ if (! $recstationname) {
$errflag = 3;
$errmsg = "放送局設定が異常です。";
@@ -128,21 +125,25 @@
//min pidを探す
$query = "SELECT min(pid) FROM foltia_subtitle ";
- $rs = m_query($con, $query, "DBクエリに失敗しました");
- $maxrows = pg_num_rows($rs);
- if ($maxrows == 0){
- $insertpid = -1 ;
+// $rs = m_query($con, $query, "DBクエリに失敗しました");
+ $rs = sql_query($con, $query, "DBクエリに失敗しました");
+ $rowdata = $rs->fetch();
+ if (! $rowdata) {
+ $insertpid = -1 ;
}else{
- $rowdata = pg_fetch_row($rs, 0);
- $insertpid = $rowdata[0];
- $insertpid-- ;
+ if ($rowdata[0] > 0) {
+ $insertpid = -1 ;
+ }else{
+ $insertpid = $rowdata[0];
+ $insertpid-- ;
+ }
}
// next 話数を探す
$query = "SELECT max(countno) FROM foltia_subtitle WHERE tid = 0";
- $rs = m_query($con, $query, "DBクエリに失敗しました");
- $maxrows = pg_num_rows($rs);
- if ($maxrows == 0){
+// $rs = m_query($con, $query, "DBクエリに失敗しました");
+ $rs = sql_query($con, $query, "DBクエリに失敗しました");
+ $rowdata = $rs->fetch();
+ if (! $rowdata) {
$nextcno = 1 ;
}else{
- $rowdata = pg_fetch_row($rs, 0);
$nextcno = $rowdata[0];
$nextcno++ ;
@@ -159,8 +160,9 @@
insert into foltia_subtitle (pid ,tid ,stationid , countno ,subtitle ,
startdatetime ,enddatetime ,startoffset , lengthmin , epgaddedby )
- values ( '$insertpid','0','$recstid',
- '$nextcno','$pname','$startdatetime','$enddatetime','0' ,'$lengthmin', '$memberid')";
+ values ( ?,'0',?,?,?,?,?,'0',?,?)";
- $rs = m_query($con, $query, "DBクエリに失敗しました");
+// $rs = m_query($con, $query, "DBクエリに失敗しました");
+//print "【DEBUG】$insertpid,$recstid,$nextcno,$pname,$startdatetime,$enddatetime ,$lengthmin,$memberid