ช่วยหน่อยนะ!! แบ่งหน้า Page ( มีตัวอย่าง) T_____T

ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา ช่วยหน่อยนะ!! แบ่งหน้า Page ( มีตัวอย่าง) T_____T

ช่วยหน่อยนะ!! แบ่งหน้า Page ( มีตัวอย่าง) T_____T
ช่วยหน่อยน่ะค่ะ พอดีว่าจะทำการแบ่งหน้าเพจ 


แบบด้านล่างอะค่ะเป็นหน้าๆ กดก่อนและหลังได้ พอดีข้อมูลมีเยอะมาก ประมาณเกือบ 2 พัน พอแบ่งหน้าให้ขึ้นข้อมูลละ 10 รายชื่อ ตัวเลขด้านใต้ก็เต็มไปหมด TT

อยากให้เป็นแบบข้างบนอะค่ะ  แบบนี้ตัวเลขเยอะเกิน 


ปล. แก้ CODE ให้ด้วยนะคะ การค้นหาเป็นแบบตามเงื่อนไขค่ะ 

<?php
			$count = 0 ;
			$limit_per_pages = 10;
			if(!isset($_GET['pages'])){
						$pages_pre = 1;
						$show_pert_page = 0;
					}else{
						$pages_pre = $_GET['pages'];
						$show_pert_page = ($limit_per_pages * ($pages_pre-1));
					}

			$count = $show_pert_page ;
			if(isset($_GET["search"])){
				$district = $_GET["district"];
				$type = $_GET["type"];
				$status = $_GET["status"];
				$name = $_GET["name"];
				$nshop = $_GET["nshop"];
				$datestart = date("Y-m-d",strtotime($_GET["datestart"]));  
				$dateexp =  date("Y-m-d",strtotime($_GET["dateexp"])); 


				$sql_district = "AND District Like '$district'";
				$sql_type = "AND type Like '%$type%' ";
				$sql_status = "AND status Like '$status' ";
				$sql_nshop = "AND nshop Like '%$nshop%' ";
				$sql_name = "AND name Like '%$name%' ";
				$sql_date = "AND  datestart >= '$datestart' AND datestart <= '$dateexp' ";


				if($district == "ทั้งหมด"){
					$sql_district = "";
				}
				if($type == "ทั้งหมด"){
					$sql_type = "";
				}
				if($status == "ทั้งหมด"){
					$sql_status = "";
				}
				if($name == ""){
					$sql_name = "";
				}
				if($nshop == ""){
					$sql_nshop = "";
				}
				if($datestart == "1970-01-01" || $dateexp == "1970-01-01" ){
					$sql_date ="";
				}


				$q_culture =  mysql_query("SELECT * FROM license WHERE id <>'0'  $sql_district $sql_status $sql_type $sql_nshop $sql_name $sql_date ");
				$count_row = mysql_num_rows($q_culture);
				$q_culture =  mysql_query("SELECT * FROM license WHERE id <>'0'  $sql_district $sql_status $sql_type $sql_nshop $sql_name  $sql_date LIMIT $show_pert_page,$limit_per_pages ");
			}else{	

				if($check_login != true){
					$sql_status = "AND status Like 'ดำเนินกิจการ'";
				}else{
					$sql_status = "";
				}

				if(!isset($_GET["district"]) || $_GET["district"] == "ทั้งหมด"){
					$q_culture =  mysql_query("SELECT * FROM license WHERE -1 $sql_status");
					$count_row = mysql_num_rows($q_culture);
					$q_culture =  mysql_query("SELECT * FROM license WHERE -1 $sql_status LIMIT $show_pert_page,$limit_per_pages");

				}else if(isset($_GET["district"])) {
					$district = $_GET["district"];
					$q_culture =  mysql_query("SELECT * FROM license WHERE District Like '$district'  $sql_status ");
					$count_row = mysql_num_rows($q_culture);
					$q_culture =  mysql_query("SELECT * FROM license WHERE District Like '$district' $sql_status LIMIT $show_pert_page,$limit_per_pages ");

				}
			}
	?>






ช่วยหน่อยน่ะค่ะ พอดีเพื่อนทำให้และไม่มีเวลาแก้ให้ค่ะ


Amamp1412 119.42.84.xxx 02-12-2014 16:07:44

คำแนะนำ และการใช้งาน

สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก


  • ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
  • เปลี่ยน


    ( หรือ เข้าใช้งานผ่าน Social Login )

 ความคิดเห็นที่ 1
ไม่มีรูปแบบโค้ดตามด้านบน ลองเอาเนื้อหานี้เปประยุกต์แทน

แนวทาง การค้นหาข้อมูล และแบ่งหน้า ด้วย php 


ninenik 171.96.17.xxx 02-12-2014






เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ