<html> <head> <title>Untitled Document</title> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /> <script src="js/prototype.js" type="text/javascript"></script> <script src="js/scriptaculous.js?load=effects,builder" type="text/javascript"></script> <script src="js/lightbox.js" type="text/javascript"></script> <meta http-equiv="Content-Type" content="text/html; charset=windows-874"></head> <body> <table align="center" width="747"> <tr><td> <? $objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database"); $objDB = mysql_select_db("changnoy"); $strSQL = "SELECT * FROM album WHERE AlbumID = '".$_GET["AlbumID"]."' "; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $objResult = mysql_fetch_array($objQuery); ?> <h1><?=$objResult["AlbumName"];?></h1> <? $strSQL2 = "SELECT * FROM gallery WHERE AlbumID = '".$_GET["AlbumID"]."' ORDER BY GalleryID ASC "; $objQuery2 = mysql_query($strSQL2) or die ("Error Query [".$strSQL2."]"); $Num_Rows = mysql_num_rows($objQuery2); $Per_Page = 12; // 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; } $strSQL2 .=" order by GalleryID ASC LIMIT $Page_Start , $Per_Page"; $objQuery2 = mysql_query($strSQL2); echo"<table border=\"1\" cellspacing=\"1\" cellpadding=\"1\"><tr>"; $intRows = 0; while($objResult2 = mysql_fetch_array($objQuery2)) { echo "<td>"; $intRows++; ?> <center> <a href="myfile/<?=$objResult2["GalleryShot"];?>" rel="lightbox[roadtrip]" title="<?=$objResult2["GalleryName"];?>"><img src="myfile/<?=$objResult2["GalleryShot"];?>" width="100" height="100"></a><br> <?=$objResult2["GalleryName"];?> <br> </center> <? echo"</td>"; if(($intRows)%5==0) { echo"</tr>"; } } echo"</tr></table>"; ?> <br> <font color="#0066CC" size="2">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> "; } ?> </font></td> </tr></table> </body> </html> <? mysql_close($objConnect); ?>
<tr> <td><h2>Topic</h2> <? $objConnect = mysql_connect("localhost","root","xxx") or die("Error Connect to Database"); $objDB = mysql_select_db("xxx"); mysql_query("SET NAMES UTF8"); //$today = date ( "d/m/y" ); $strSQL = "SELECT * FROM gallery WHERE AlbumID = '".$_GET["AlbumID"]."' ORDER BY GalleryID ASC "; $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 date_order DESC LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); ?> <table width="110" border="0"> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td width="627" valign="top"><div align="left" class="style32"> <a href="myfile/<?=$objResult2["GalleryShot"];?>" rel="lightbox[roadtrip]" title="<?=$objResult2["GalleryName"];?>"><img src="myfile/<?=$objResult2["GalleryShot"];?>" width="100" height="100"></a><br> <?=$objResult2["GalleryName"];?> </a><span class="style37"></span></div></td> </tr> <? } ?> </table> <table width="400" border="0"> <tr> <td><div align="center"> <div align="center" class="style20"> <div align="left"><strong> total <?= $Num_Rows;?> pic : <?=$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> "; } ?> </strong></div> </div></td> </tr> </table> <table width="682" border="0"> <tr> <td> </td> </tr>
<? include('db_function.php'); $db = new db; ?> <meta charset="utf-8"> <link href="assets/css/bootstrap.css" rel="stylesheet"> <link href="assets/css/demo_table.css" rel="stylesheet"> <script src="assets/js/jquery-1.7.1.min.js"></script> <script src="assets/js/jquery.dataTables.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $('#datatables').dataTable(); }); </script> <? $sql = mysql_query("select * from data"); ?> <br /><br /><br /> <center> <table width="600"> <tr> <td> <table id="datatables" class="display table-bordered" style="width:500px;"> <thead><tr><th>ลำดับ</th><th>วันที่</th><th>ข้อมูล</th></tr></thead> <tbody> <?php $i=1; while($data = mysql_fetch_array($sql)){ echo '<tr><td>'.$i.'</td><td>'.$data['day'].'/'.$data['month'].'/'.$data['year'].'</td><td>'.$data['meter'].'</td></tr>'; $i++; } ?> </tbody> </table> </td> </tr> </table> </center>
<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>datatable example</title> <style type="text/css" title="currentStyle"> @import "media/css/demo_table.css"; </style> <!--ไฟล์ css อยู่ใน folder ที่เรา ดาวน์โหลดมา เมื่อนำมาใช้ กำหนด path ไฟล์ให้ถูกต้อง--> <script type="text/javascript" charset="utf-8" src="media/js/jquery.js"></script> <script type="text/javascript" charset="utf-8"src="media/js/jquery.dataTables.js"></script> <!--ไฟล์ js อยู่ใน folder ที่เรา ดาวน์โหลดมา เมื่อนำมาใช้ กำหนด path ไฟล์ให้ถูกต้อง--> <script type="text/javascript" charset="utf-8"> $(document).ready( function () { $('#example').dataTable( { "sPaginationType" : "full_numbers",// แสดงตัวแบ่งหน้า "bLengthChange": true, // แสดงจำนวน record ที่จะแสดงในตาราง ไม่เอาใส่ false "iDisplayLength": 10, // กำหนดค่า default ของจำนวน record "bFilter": true, // แสดง search box ไม่เอาใส่ false "sScrollY": "400px", // กำหนดความสูงของ ตาราง } ); } ); </script> </head> <body> <table cellpadding="0" cellspacing="0" border="0" class="display datatable" id="example"> // id ต้องตรงกับ js ข้างบน <thead> // ต้องมี <tr> <th>test</th> </tr> </thead> <tbody>//ต้องมี // ก็ database ที่จะ select $sql = "select * from table1"; $rs = mysql_query($sql); while($row = mysql_fetch_array($rs)) { echo "<tr><td>".$row["id"]."</td></tr>"; } </tbody> </table> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง