<!DOCTYPE html> <html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″> <link rel="stylesheet" href="css/style.css"> </style> </head> <body> <?php $q = intval($_GET['q']); $serverName = "localhost"; $userName = "root"; $userPassword = "abcd1234"; $dbName = "thaimee"; $con = mysqli_connect($serverName,$userName,$userPassword,$dbName); mysqli_set_charset($con, "utf8"); if (!$con) { die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,"thaimee"); $sql="SELECT * FROM product order by Productname ASC "; if ($q!=0) $sql="SELECT * FROM product WHERE CategoryID = '".$q."'"; $result = mysqli_query($con,$sql); $num_rows = mysqli_num_rows($result); $per_page = 50; // Per Page $page = 1; if(isset($_GET["Page"])) { $page = $_GET["Page"]; } $prev_page = $page-1; $next_page = $page+1; $row_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; } $row_end = $per_page * $page; if($row_end > $num_rows) { $row_end = $num_rows; } $sql = " ORDER BY Productname ASC LIMIT $row_start ,$row_end "; $query = mysqli_query($con,$sql); echo "<table class='Thaimeetable'> <tr> <td>No.</td> <td>Name</td> <td>Description</td> <td>Product (TH)</td> <td>ShelfLife</td> <td>Packing&Flavor</td> </tr>"; $i = 1; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $i . "</td>"; echo "<td>" . $row['Productname'] . "</td>"; echo "<td>" . $row['Product_description'] . "</td>"; echo "<td>" . $row['Product_thainame'] . "</td>"; echo "<td>" . $row['ShelfLife'] . "</td>"; echo "</td><td>"; echo "<a href='product_packing_flavor.php?FilesID=".$row['ProductID']."'target='_blank'>Packing&Flavor</a>"; echo "</td>"; echo "</tr>"; $i++; } echo "</table>"; ?> <br> Total <?php echo $num_rows;?> Record : <?php echo $num_pages;?> Page : <?php 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</a> ]"; } else { echo "<b> $i </b>"; } } if($page!=$num_pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$next_page'>Next>></a> "; } mysqli_close($con); ?> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง