include("public_inc.php"); connectdb(); charSetThai(); loadControl(); $TypeIDRE = $requ["typeid"]; if($TypeIDRE != ''){ $WhereTypeID = "and TypeID = '$TypeIDRE'"; }else{ $WhereTypeID = ""; } $TypeSubIDRE = $requ["typesubid"]; if($TypeSubIDRE != ''){ $WhereTypeSubID = "and TypeSubID = '$TypeSubIDRE'"; }else{ $WhereTypeSubID = ""; } $TypeSub2IDRE = $requ["typesub2id"]; if($TypeSub2IDRE != ''){ $WhereTypeSub2ID = "and TypeSub2ID = '$TypeSub2IDRE'"; }else{ $WhereTypeSub2ID = ""; } $SortByPrice = $requ["SortByPrice"]; if($SortByPrice == "1"){ $whereSortBy = "ProductPrice DESC, "; }else if($SortByPrice == "2"){ $whereSortBy = "ProductPrice ASC, "; }else{ $whereSortBy = ""; } if ($_SERVER['SCRIPT_NAME']) { $scriptname = $_SERVER['SCRIPT_NAME']; } if ($_SERVER['QUERY_STRING']) { $scriptname .= "?".$_SERVER['QUERY_STRING']; } $Con_GalleryPage = $ProductPage; $currentPage = $_SERVER["PHP_SELF"]; $range = 5; // จำนวนแสดงหน้าและหลังเลขหน้าที่เลือก $pageNum = 1; if (isset($_GET['page'])) { $pageNum= $_GET['page']; } $startRowQuery = ($pageNum-1 )* $Con_GalleryPage; $sql = "select * from gac_tblproduct where ProductOnlineStatus = 'Y' $WhereTypeID $WhereTypeSubID $WhereTypeSub2ID Order by $whereSortBy DateRegister DESC"; $querylimit = sprintf("%s LIMIT %d, %d", $sql, $startRowQuery, $Con_GalleryPage); $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_GalleryPage); ?> if ($pageNum == 1) { $start= 1; $limit = $Con_GalleryPage; if($limit > $totalRows){$limit = $totalRows;} }else{ $start= ($Con_GalleryPage*$pageNum)-1; $limit = ($Con_GalleryPage*$pageNum); if($limit > $totalRows){$limit = $totalRows;} } ?> $pagegoto = ($pageNum-1) * $Con_PhotoPage; // หาหน้าที่จะกระโดดไป $pagestart = $pageNum - $range; $pageend = $pageNum + $range; if ($pagestart <= 1) { $pagestart = 1; } if ($pageend >= $totalPages) { $pageend = $totalPages; } ?>
include('include_title.php')?>
|
||||||||||