  | 
		 		   | 
	  	    
          
            
			
	
			
			 
                ผมได้ใช้วิธีการแบ่งหน้าจากการดึงข้อมูล TABLE มาแสดงจากลิงค์นี้ครับ https://www.thaicreate.com/php/php-mysql-list-record-paging.html 
 
ก็สามารถแบ่งหน้าได้ตามต้องการทุกประการ ติดที่ว่าตัวค้นหาที่ผมเคยใช้ มันไม่ค้นหาข้อมูลในหน้าอื่นครับ พอจะมีวิธีแก้ไขได้อย่างไรบ้างครับ  
 
ตัวค้นหาที่ว่าคือ ตัว javascript ที่ชื่อว่า LightTableFilter  
 
ขอบคุณมากครับ  
 
 
 
 
Code 
<?php 
mysql_connect("localhost","table","pass"); 
mysql_select_db("table"); 
 
$strSQL = "SELECT  * FROM logistic "; 
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); 
$Num_Rows = mysql_num_rows($objQuery); 
 
$Per_Page = 10;   // Per Page 
 
$Page = $_GET["Page"]; 
if(!$_GET["Page"]) 
{ 
	$Page=1; 
} 
 
$Prev_Page = $Page-1; 
$Next_Page = $Page+1; 
 
$Page_Start = (($Per_Page*$Page)-$Per_Page); 
if($Num_Rows<=$Per_Page) 
{ 
	$Num_Pages =1; 
} 
else if(($Num_Rows % $Per_Page)==0) 
{ 
	$Num_Pages =($Num_Rows/$Per_Page) ; 
} 
else 
{ 
	$Num_Pages =($Num_Rows/$Per_Page)+1; 
	$Num_Pages = (int)$Num_Pages; 
} 
 
$strSQL .=" order  by id DESC LIMIT $Page_Start , $Per_Page"; 
$objQuery  = mysql_query($strSQL); 
?> 
 
<div class="row"> 
	<img src="http://ems.cnyholding.co.th/dc/print.png" style="float: right; text-align: right;" onclick=" JsPrint('ctt'); "><br><p style=" right: text-align: right; "> <b>กดที่ icon เครื่องพริ้น เพื่อพิมพ์รายงาน</b></p> 
<div> 
  <input type="search" id="product_code_big" class="light-table-filter" data-table="order-table" placeholder="ระบุสิ่งที่ต้องการค้น เลขบิล วันที่ ผู้จำหน่าย สาขา เป็นต้น">	 
  <table id="ctt" class="order-table table" style="width:100%"> 
    <thead> 
      <tr class="header"> 
	    <th>ที่</th> 
        <th>วันที่รับสินค้า</th> 
		<th>วันที่ในบิล</th> 
        <th>เลขที่บิลขนส่ง</th> 
		<th>ผู้ให้บริการ</th> 
        <th>สาขาที่รับ</th> 
        <th>ผู้ส่ง</th> 
		<th>รายการ</th> 
		<th>ยอดเงิน</th> 
		<th>สถานะ</th> 
		<th>แก้ไข</th> 
		 
        <? 
		while($objResult = mysql_fetch_array($objQuery)) 
		{ 
		?> 
   
 
      </tr> 
    </thead> 
    <tbody> 
 
		<td><?php echo $objResult["id"];?></td> 
        <td><?php echo $objResult["date1"];?></td> 
        <td><?php echo $objResult["date2"];?></td> 
        <td><?php echo $objResult["ref"];?></td> 
        <td><?php echo $objResult["namesup"];?></td> 
		<td><?php echo $objResult["branch"];?></td> 
		<td><?php echo $objResult["supcontact"];?></td> 
		<td><?php echo $objResult["detail"];?></td> 
		<td><?php echo $objResult["price1"];?></td> 
		<td><?php echo $objResult["status"];?></td> 
		<td><font color="red" ><a href="editlogisticaction.php?id=<?php echo $objResult["id"];?>">แก้ไข</a></font></td> 
 
     </tbody> 
<? 
} 
?> 
  </table> 
Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : 
<? 
if($Prev_Page) 
{ 
	echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> "; 
} 
 
for($i=1; $i<=$Num_Pages; $i++){ 
	if($i != $Page) 
	{ 
		echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]"; 
	} 
	else 
	{ 
		echo "<b> $i </b>"; 
	} 
} 
if($Page!=$Num_Pages) 
{ 
	echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> "; 
} 
 
?> 
 
      <script> 
		(function(document) { 
			'use strict'; 
 
			var LightTableFilter = (function(Arr) { 
 
				var _input; 
 
				function _onInputEvent(e) { 
					_input = e.target; 
					var tables = document.getElementsByClassName(_input.getAttribute('data-table')); 
					Arr.forEach.call(tables, function(table) { 
						Arr.forEach.call(table.tBodies, function(tbody) { 
							Arr.forEach.call(tbody.rows, _filter); 
						}); 
					}); 
				} 
 
				function _filter(row) { 
					var text = row.textContent.toLowerCase(), val = _input.value.toLowerCase(); 
					row.style.display = text.indexOf(val) === -1 ? 'none' : 'table-row'; 
				} 
 
				return { 
					init: function() { 
						var inputs = document.getElementsByClassName('light-table-filter'); 
						Arr.forEach.call(inputs, function(input) { 
							input.oninput = _onInputEvent; 
						}); 
					} 
				}; 
			})(Array.prototype); 
 
			document.addEventListener('readystatechange', function() { 
				if (document.readyState === 'complete') { 
					LightTableFilter.init(); 
				} 
			}); 
 
		})(document); 
 
      </script> 
	          <script type="text/javascript"> 
 
 
            function PrintPanel(tableId) { 
                var divContents = document.getElementById(tableId).outerHTML; 
 
                var printWindow = window.open('', '', 'height=1000,width=800,scrollbars=1');        //สร้าง popup 
                printWindow.document.write('<html><head><title>ศูนย์กระจายสินค้ากลาง</title>'); 
                printWindow.document.write('<img src="http://ems.cnyholding.co.th/dc/theme/images/rsz_logo_bill_web2.png"> <br>'); 
                printWindow.document.write('<center><p class="b"><?php echo "สรุปข้อมูลบิลขนส่ง ตามผู้ให้บริการ ค้นหาตามช่วงวัน รายงาน ณ วันที่  " . date("d/m/Y") . "<br>"; ?></center></p>'); 
			    printWindow.document.write('<hr>'); 
                printWindow.document.write('<link rel="stylesheet" href="TableCSS_Header.css" type="text/css" />'); 
    	 
 
                printWindow.document.write('</head><body onLoad="self.print();self.close();">'); // สั่ง Print เมื่อ reder เสร็จ 
                printWindow.document.write(divContents); 
 
                printWindow.document.write('</body></html>'); 
                printWindow.document.close(); 
 
                //printWindow.print();   print แบบนี้มีปัญหา run ไม่ได้ทุก Browser 
            } 
 
            function JsPrint(tableId) { 
                PrintPanel(tableId); 
            } 
			n =  new Date(); 
			y = n.getFullYear(); 
			m = n.getMonth() + 1; 
			d = n.getDate(); 
			document.getElementById("date").innerHTML = m + "/" + d + "/" + y; 
			 
		</script>		 
 
</head> 
 
 
  Tag : PHP, MySQL, CSS, JavaScript               
                        | 
           
          
            | 
			
                             | 
           
          
            
              
                   | 
                   | 
                   | 
               
              
                   | 
                
                    
                      | Date :
                          2018-03-31 23:12:38 | 
                      By :
                          giantkim | 
                      View :
                          988 | 
                      Reply :
                          3 | 
                     
                  | 
                   | 
               
              
                   | 
                   | 
                   | 
               
              | 
           
          
            | 
			 | 
           
         
	    
		             | 
		
			  |