require("./lib/const.php"); // DB接続 global $title; global $auther; global $recommend; global $Submit; global $name; session_start(); $_SESSION["name"]= $name; $name_ses = $_SESSION["name"]; if($name != $name_ses) { $m_url=$m_url."./error.htm"; header("Location: ".$m_url); exit(); } if($name ==""){ $m_url=$m_url."./error.htm"; header("Location: ".$m_url); exit(); } $newURL = "./bookupdate.php"; $arrBookid = array(); $arrTitle = array(); $arrAuther = array(); $arrRecommend = array(); if($Submit != "") { // bookshelf テーブルから値取得 $SQL = "SELECT bookid, title, auther, recommend FROM bookshelf WHERE delFlg=0"; $order = " ORDER BY bookid"; $cond = ""; if($title != "") { $cond = " AND title LIKE '%$title%'"; } if($auther != "") { $cond = " AND auther LIKE '%$auther%'"; } if($recommend != "") { $cond = " AND recommend = '$recommend'"; } $SQL = $SQL . $cond . $order; //echo $SQL; $result = mysql_query($SQL); if($result == FALSE) { echo "データベースエラー!\n"; exit; } $num_rows = mysql_num_rows($result); // 取得レコード件数 $i = 0; while($row = mysql_fetch_array($result)){ // 取得結果を配列に保存 $arrBookid[$i] = $row[0]; $arrTitle[$i] = $row[1]; $arrAuther[$i] = $row[2]; $arrRecommend[$i] = $row[3]; $i++; } mysql_free_result($result); } require("./lib/concls.php"); // DB切断 ?>
N0. | "); print("タイトル | "); print("著者 | "); print("オススメ度 | "); print("
$roop | "); print("$arrTitle[$i] | "); print("$arrAuther[$i] | "); print("$arrRecommend[$i] | "); print("