コラム
_db_server, $consts->_db_user, $consts->_db_password); mysqli_query("SET NAMES utf8",$db); mysqli_select_db($db, $consts->_db_name); $db_tb = $consts->_blog_tb; $query = "SELECT * FROM $db_tb WHERE (up_fg = 1)"; $query2 = "SELECT count(*) FROM $db_tb WHERE (up_fg = 1)"; 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 = 4; $offset = $page_num*$row_max; $query .= " limit $row_max offset $offset"; // --------------------------------------------------------------- $res = mysqli_query($db,$query); $result = mysqli_query($db,$query2); $row2 = mysqli_fetch_assoc($result); $cnt = $row2["count(*)"]; ?>
© Copyright 株式会社グローバルフーズ. All Rights Reserved.