チェンジセット 94: trunk/install/php/reservecomp.php
- コミット日時:
- 2010/02/28 22:28:26 (15 年前)
- ファイル:
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
trunk/install/php/reservecomp.php
r83 r94 67 67 68 68 //タイトル取得 69 $query = "select title from foltia_program where tid ='$tid'";70 $rs = m_query($con, $query, "DBクエリに失敗しました");71 $ maxrows = pg_num_rows($rs);72 73 if ($maxrows == 0) {69 $query = "select title from foltia_program where tid = ? "; 70 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 71 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); 72 $rowdata = $rs->fetch(); 73 if (! $rowdata) { 74 74 $title = "(未登録)"; 75 75 }else{ 76 $rowdata = pg_fetch_row($rs, 0);77 76 $title = htmlspecialchars($rowdata[0]); 78 77 } … … 130 129 } 131 130 $rs = m_query($con, $query, "DBクエリに失敗しました"); 132 $maxrows = pg_num_rows($rs); 133 134 if ($maxrows == 0) { 131 $rowdata = $rs->fetch(); 132 if (! $rowdata) { 135 133 echo("放映予定はいまのところありません<BR>"); 136 134 } 137 135 else{ 138 $maxcols = pg_num_fields($rs);136 $maxcols = $rs->columnCount(); 139 137 ?> 140 138 <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%" BGCOLOR="#bcf1be"> … … 155 153 <?php 156 154 /* テーブルのデータを出力 */ 157 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 155 do { 158 156 echo("<tr>\n"); 159 /* pg_fetch_row で一行取り出す */160 $rowdata = pg_fetch_row($rs, $row);161 162 157 for ($col = 0; $col < $maxcols; $col++) { /* 列に対応 */ 163 158 echo("<td>".htmlspecialchars($rowdata[$col])."<br></td>\n"); 164 159 } 165 160 echo("</tr>\n"); 166 } 161 } while ($rowdata = $rs->fetch()); 167 162 }//end if 168 163 ?> … … 177 172 //既存が予約あって、新着が全局予約だったら 178 173 if ($station ==0){ 179 $query = "180 SELECT181 *182 FROM foltia_tvrecord183 WHERE tid = '$tid'184 ";185 $rs = m_query($con, $query, "DBクエリに失敗しました");186 $maxrows = pg_num_rows($rs);187 if ($maxrows > 0){188 174 //既存局を消す 189 175 $query = "DELETE 190 176 FROM foltia_tvrecord 191 WHERE tid = '$tid'192 "; 193 $rs = m_query($con, $query, "DBクエリに失敗しました");194 }177 WHERE tid = ? 178 "; 179 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 180 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); 195 181 }//endif 196 182 197 183 $query = " 198 184 SELECT 199 *185 count(*) 200 186 FROM foltia_tvrecord 201 WHERE tid = '$tid' AND stationid = '$station'202 "; 203 $rs = m_query($con, $query, "DBクエリに失敗しました");204 $ maxrows = pg_num_rows($rs);205 187 WHERE tid = ? AND stationid = ? 188 "; 189 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 190 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid,$station)); 191 $maxrows = $rs->fetchColumn(0); 206 192 if ($maxrows == 0) { //新規追加 207 $query = "INSERT INTO foltia_tvrecord values ('$tid','$station','$bitrate','$usedigital')"; 208 $rs = m_query($con, $query, "DB書き込みに失敗しました"); 193 $query = "INSERT INTO foltia_tvrecord values (?,?,?,?)"; 194 // $rs = m_query($con, $query, "DB書き込みに失敗しました"); 195 $rs = sql_query($con, $query, "DB書き込みに失敗しました",array($tid,$station,$bitrate,$usedigital)); 209 196 }else{//修正 (ビットレート) 210 197 $query = "UPDATE foltia_tvrecord SET 211 bitrate = '$bitrate' , digital = '$usedigital' WHERE tid = '$tid' AND stationid = '$station' "; 212 $rs = m_query($con, $query, "DB書き込みに失敗しました"); 198 bitrate = ? , digital = ? WHERE tid = ? AND stationid = ? "; 199 // $rs = m_query($con, $query, "DB書き込みに失敗しました"); 200 $rs = sql_query($con, $query, "DB書き込みに失敗しました",array( $bitrate, $usedigital , $tid , $station )); 213 201 } 214 202