if ($_SERVER['SCRIPT_NAME']) {
$scriptname = $_SERVER['SCRIPT_NAME'];
}
if ($_SERVER['QUERY_STRING']) {
$scriptname .= "?".$_SERVER['QUERY_STRING'];
}
$Con_NewsPage = 10;
$currentPage = $_SERVER["PHP_SELF"];
$range = 5; // จำนวนแสดงหน้าและหลังเลขหน้าที่เลือก
$pageNum = 1;
if (isset($_GET['page'])) {
$pageNum= $_GET['page'];
}
$startRowQuery = ($pageNum-1 )* $Con_NewsPage; /*AND (DateStart < '".date('Y-m-d')."' AND DateEnd >= '".date('Y-m-d')."' ) */
$sql = "select * from asl_tblpromotion where OnlineStatus = 'Y' Order by LocationShow ASC, DateRegister DESC";
$querylimit = sprintf("%s LIMIT %d, %d", $sql, $startRowQuery, $Con_NewsPage);
$result= mysql_query($querylimit);
if (isset($_GET['totalRows'])) {
$totalRows = $_GET['totalRows'];
} else {
$allQuery= mysql_query($sql);
if($allQuery){
$totalRows = mysql_num_rows($allQuery);
}
}
$totalPages = ceil($totalRows/$Con_NewsPage);
?>
if ($pageNum == 1) {
$start= 1;
$limit = $Con_NewsPage;
if($limit > $totalRows){$limit = $totalRows;}
}else{
$start= ($Con_NewsPage*$pageNum)-1;
$limit = ($Con_NewsPage*$pageNum);
if($limit > $totalRows){$limit = $totalRows;}
}
?>
$pagegoto = ($pageNum-1) * $Con_NewsPage; // หาหน้าที่จะกระโดดไป
$pagestart = $pageNum - $range;
$pageend = $pageNum + $range;
if ($pagestart <= 1) {
$pagestart = 1;
}
if ($pageend >= $totalPages) {
$pageend = $totalPages;
}
?>
Retirement and Long Stay Resort Thailand | Home and Resort