분해 # 1 - 게시판설정 - list
플래토
0
7932
0
0
2021.12.02 13:26
$sql_common = " from {$g5['board_table']} a "; $sql_search = " where (1) "; if ($is_admin != "super") { $sql_common .= " , {$g5['group_table']} b "; $sql_search .= " and (a.gr_id = b.gr_id and b.gr_admin = '{$member['mb_id']}') "; } if ($stx) { $sql_search .= " and ( "; switch ($sfl) { case "bo_table" : $sql_search .= " ($sfl like '$stx%') "; break; case "a.gr_id" : $sql_search .= " ($sfl = '$stx') "; break; default : $sql_search .= " ($sfl like '%$stx%') "; break; } $sql_search .= " ) "; } if (!$sst) { $sst = "a.gr_id, a.bo_table"; $sod = "asc"; } $sql_order = " order by $sst $sod "; $sql = " select count(*) as cnt {$sql_common} {$sql_search} {$sql_order} "; $row = sql_fetch($sql); $total_count = $row['cnt']; $rows = $config['cf_page_rows']; $total_page = ceil($total_count / $rows); // 전체 페이지 계산 if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) $from_record = ($page - 1) * $rows; // 시작 열을 구함 $sql = " select * {$sql_common} {$sql_search} {$sql_order} limit {$from_record}, {$rows} "; $result = sql_query($sql);