전체페이지보다 현재페이지가 클때 데이타가 안나오는 경우 > 자료실

자료실

자료실

전체페이지보다 현재페이지가 클때 데이타가 안나오는 경우

페이지 정보

profile_image
작성자 최고관리자
댓글 0 조회 321회 작성일 23-02-20 13:59
작성일 23-02-20 13:59

본문

// 테이블의 전체 레코드수만 얻음

$_tot_sql = " SELECT count(*)AS cnt " . $sql_common;

$_tot_row = sql_fetch($_tot_sql);

$total_count = $_tot_row[cnt];


$rows = $bcount;

$total_page  = ceil($total_count / $rows);  // 전체 페이지 계산

$from_record = ($page - 1) * $rows; // 시작 열을 구함


if($total_count < $rows) : // 현재페이지 토탈건수

	$page_total_count = $total_count;

else :

	$page_total_count = $rows;

endif;


if($_cma_save_excel == "yes") :// 엑셀저장

	$_limit_common = "";

else : // 엑셀모드가 아닐때


	if($page > $total_page) : // 페이지 변경시 전체페이지보다 현재 페이지가 클때 $from_record 초기화​

		$from_record = 0;

	endif;


	$_limit_common = " LIMIT ".$from_record.", ".$rows." ";

endif;


$sql  = " SELECT ";

$sql  .= " * ";

$sql  .= $sql_common." ".$sql_order." ".$_limit_common;


추천 0 비추천 0

  • 회사 :
  • 대표 :
  • 주소 :
  • 메일 : admin@mysample.com
  • 사업자 등록번호 :
Copyright © cginjs.com All rights reserved.
notice