<?php session_start(); include "conn.php"; $Mem_ID = $_SESSION['ses_user_id']; $Mem_Name = $_SESSION['ses_user_name']; ?> <!DOCTYPE html> <html> <head> <title><?php echo $title; ?></title> </head> <body> <form action="chk_product.php" method="get" accept-charset="utf-8"> <div align="center"><h1 style="color: gray">ยินดีต้อนรับ <?php echo $Mem_Name; ?></h1></div> <?php $query = mysqli_query($conn,"select * from product" ); ?> <div align="center"><h1>Booth</h1></div> <table border="1" align="center"> <tr align="center"> <th>ลำดับ</th> <th>รูปภาพ</th> <th>ชื่อบูธ</th> <th>ราคา</th> <th>จำนวนของที่มี</th> <th>จำนวนของที่เหลือ</th> <th>เลือก</th> </tr> <?php $n = 1; while ($result = mysqli_fetch_assoc($query)) { ?> <tr align="center"> <td> <?php echo $n++; ?> </td> <td> <img src="<?php echo $result['Pro_Pic']; ?>" style= "width: 200px;height: 150px;"> </td> <td> <?php echo $result['Pro_Name']; ?> </td> <td> <?php echo $result['Pro_Price']; ?> </td> <td> <?php echo $result['Pro_Storage']; ?> </td> <td> <?php echo $result['Pro_Available']; ?> </td> <td> <input type="checkbox" name="use[]" value="<?php echo $result['Pro_ID']; ?>"> </td> </tr> <?php } ?> </table> <div align="center"> <input type="submit" value= "submit" style="width: 150px;height: 30px;"> <input type="reset" value="Cancel"> <input type="button" value="Logout" onclick="window.location = 'logout.php'"> </div> </form> </body> </html>
<?php session_start(); $Mem_ID = $_SESSION['ses_user_id']; include "conn.php"; $use = array(); $use = $_POST['use']; for($i=0;$i<count($use);$i++) { if($use[$i]!="") { @mysqli_query($conn,"UPDATE product SET Pro_Use = Pro_Use+1 "); echo "<script type='text/javascript' charset='utf-8'> alert('ทำการ เช่าสำเร็จ'); window.location = 'product.php'; </script>"; } } ?>
$id_list = filter_input(INPUT_POST, 'use'); $af=0; foreach( $id_list as $id ){ $conn->query("UPDATE product SET Pro_Use = Pro_Use+1 where Pro_ID=" . intval($id) ); $af+=$conn->affected_rows; } echo 'จำนวนที่ได้รับการ update = '.$af;
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง