_db_server, $consts->_db_user, $consts->_db_password); mysqli_query($db,"SET NAMES utf8"); mysqli_select_db($db, $consts->_db_name); $db_tb = $consts->_event_tb; $query = "SELECT * FROM $db_tb WHERE (up_fg = 1)"; $query2 = $query; if($yearmonth){ $query .= " AND (DATE_FORMAT(entry_date, '%Y%m') = $yearmonth )";// 指定の年月のデータを抽出 $query2 .= " AND (DATE_FORMAT(entry_date, '%Y%m') = $yearmonth )";// 指定の年月のデータを抽出 } $query .= " ORDER BY entry_date DESC";// 日付でソート // 表示行の管理 -------------------------------------------------- $row_max = 10; $offset = $page_num*$row_max; $query .= " limit $row_max offset $offset"; // --------------------------------------------------------------- $res = mysqli_query($db,$query); // 要素のカウンタ(最新) $res2 = mysqli_query($db, $query2); $cnt = $res2->num_rows; //$result = mysqli_query($db,$query2); //$row2 = mysqli_fetch_assoc($result); //$cnt = $row2["count(*)"]; ?>