<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> <script href="bootstrap1/js/bootstrap.min.js" rel="stylesheet"></script> <link href="bootstrap1/css/bootstrap.min.css" rel="stylesheet"> <link href="bootstrap1/css/bootstrap-responsive.min.css" rel="stylesheet"> </head> <body> <form name="frmSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>"> <fieldset> Search : <input name="txtKeyword" id="txtKeyword" type="text" placeholder="Type something"/> </fieldset> <input type="checkbox" name="Language" id="Language" value="th"> <select name="Lang"> <option value="">Select Language</option> <option value="android">android</option> <option value="java">java</option> </select> <br/> <input type="submit" name="Submit" value="Submit" class="btn"> <br/> <br/><br/> </form> <script src="http://code.jquery.com/jquery-1.7.min.js" ></script> <script src="bootstrap/FileUpload/bootstrap-fileupload.js" type="text/javascript"></script> <script> $(document).ready(function(){ unlock(); $("[name=Language]").change(function(){ unlock(); }); }); function unlock(){ if($("[name=Language]").is(':checked')){ $("[name=Lang]").attr("disabled",false); } else{ $("[name=Lang]").attr("disabled",true); } } </script> </body> </html> <? if($_GET["txtKeyword"] != "" || $_GET["Language"] != "") { $objConnect = mysql_connect("localhost","root","123") or die("Error Connect to Database"); $objDB = mysql_select_db("test"); $strSQL = "SELECT * FROM test WHERE (Name LIKE '%".$_GET["txtKeyword"]."%' and Language LIKE '%".$_GET["Language"]."%')"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 2; // 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 ASC LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); ?> <table width="600" border="1"> <tr> <th width="91"> <div align="center">CustomerID </div></th> <th width="98"> <div align="center">Name </div></th> <th width="198"> <div align="center">Email </div></th> <th width="97"> <div align="center">Language </div></th> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td><div align="center"><?=$objResult["ID"];?></div></td> <td><?=$objResult["Name"];?></td> <td><?=$objResult["Email"];?></td> <td><div align="center"><?=$objResult["Language"];?></div></td> </tr> <? } ?> </table> <br> Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtKeyword=$_GET[txtKeyword]'><< Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtKeyword=$_GET[txtKeyword]'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtKeyword=$_GET[txtKeyword]'>Next>></a> "; } mysql_close($objConnect); } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง