Quote:<html> <head> <title>Member ระบบสมาชิก</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css"> <!-- body,td,th { font-family: Microsoft Sans Serif; } --> </style></head> <body> <h1>:: View Member ::</h1> <table border="1"> <tr bgcolor="#D3D3D3"> <td>ลำดับ</td> <td>Username</td> <td>อีเมล</td> <td>วันที่สมัคร</td> <td>Keycode</td> <td>ต้องการ</td> </tr> <? $count=0; include "config.php"; $sql="select * from topup order by date_is desc"; $result=mysql_db_query($dbname,$sql); /*Connect ฐานข้อมูล */ mysql_connect('localhost','root','1234'); // connect mysql mysql_select_db('true'); // select database /* check ว่ามี ค่าตัวแปร $start หรือไม่ ถ้าไม่มีให้ตั้งเป็น 0 ปล. อันนี้ต้องใช้กับตัวแบ่งนะ ห้ามเอาออก*/ if(!isset($start)){ $start = 0; } $limit = '5'; // แสดงผลหน้าละกี่หัวข้อ /* หาจำนวน record ทั้งหมด ปล. อันนี้ต้องใช้กับตัวแบ่งนะ ห้ามเอาออก*/ $Qtotal = mysql_query("select * from topup"); //คิวรี่ คำสั่ง $total = mysql_num_rows($Qtotal); // หาจำนวน record /* คิวรี่ข้อมูลออกมาเพื่อแสดงผล */ $Query = mysql_query("SELECT * FROM topup ORDER BY id DESC LIMIT $start,$limit"); //คิวรี่คำสั่ง $totalp = mysql_num_rows($Query); // หาจำนวน record ที่เรียกออกมา /* อันนี้ ไม่เกี่ยวเอาออกได้ */ printf("มีหัวข้อทั้งหมด %d หัวข้อ / ",$total); printf("แสดงหน้าละ %d หัวข้อ<br />",$totalp); echo "<hr />"; /* วนลูปข้อมูล */ while($arr = mysql_fetch_array($Query)){ while($record=mysql_fetch_array($result)) { $count++; echo " <tr> <td>$count</td> <td>$record[userid]</td> <td>$record[email]</td> <td>$record[date_is]</td> <td>$record[key_code]</td> <td><a href=\"delete.php?id_del=$record[id]\"onclick=\"return confirm(' ต้องการลบ $record[name] ออกจากระบบหรือไม่ ')\">ลบ</a></td> </tr>"; } } echo "<hr>"; /* ตัวแบ่งหน้า */ $page = ceil($total/$limit); // เอา record ทั้งหมด หารด้วย จำนวนที่จะแสดงของแต่ละหน้า /* เอาผลหาร มาวน เป็นตัวเลข เรียงกัน เช่น สมมุติว่าหารได้ 3 เอามาวลก็จะได้ 1 2 3 */ for($i=1;$i<=$page;$i++){ if($_GET['page']==$i){ //ถ้าตัวแปล page ตรง กับ เลขที่วนได้ echo "[<a href='?start=".$limit*($i-1)."&page=$i'><B>$i</B></A>]"; //ลิ้งค์ แบ่งหน้า เงื่อนไขที่ 1 }else{ echo "[<a href='?start=".$limit*($i-1)."&page=$i'>$i</A>]"; //ลิ้งค์ แบ่งหน้า เงื่อนไขที่ 2 } } mysql_close(); ?> </table> </body> </html>
<html> <head> <title>ThaiCreate.Com PHP & MySQL Tutorial</title> </head> <body> <? $objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database"); $objDB = mysql_select_db("mydatabase"); $strSQL = "SELECT * FROM customer "; $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 CustomerID 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">CountryCode </div></th> <th width="59"> <div align="center">Budget </div></th> <th width="71"> <div align="center">Used </div></th> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td><div align="center"><?=$objResult["CustomerID"];?></div></td> <td><?=$objResult["Name"];?></td> <td><?=$objResult["Email"];?></td> <td><div align="center"><?=$objResult["CountryCode"];?></div></td> <td align="right"><?=$objResult["Budget"];?></td> <td align="right"><?=$objResult["Used"];?></td> </tr> <? } ?> </table> <br> 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> "; } mysql_close($objConnect); ?> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง