<meta http-equiv=Content-Type content="text/html; charset=utf-8"> <?error_reporting(E_ALL ^ E_NOTICE);mysql_query("SET NAMES UTF8");ob_start();session_start(); require("connect.php");require("function.php"); if($_GET["p_id"] != "") //รับ p_id จากหน้าที่แล้ว {for($i=0;$i<=count($_SESSION["np_id"]);$i++) { if($_SESSION["np_id"][$i] == $_GET["p_id"]) {header("location:$_SERVER[PHP_SELF]");exit();} } } if(trim($_GET["p_id"]) != "") { $_SESSION["nP"]=$_SESSION["nP"]+1; $_SESSION["np_id"][$_SESSION[nP]]=$_GET["p_id"]; session_write_close(); header("location:$_SERVER[PHP_SELF]"); } /รับ c_id จากหน้าที่แล้ว if($_GET["c_id"] != "") {for($i=0;$i<=count($_SESSION["nc_id"]);$i++) { if($_SESSION["nc_id"][$i] == $_GET["c_id"]) {header("location:$_SERVER[PHP_SELF]");exit();} } } if(trim($_GET["c_id"]) != "") { $_SESSION["nP"]=$_SESSION["nP"]+1; $_SESSION["nc_id"][$_SESSION[nP]]=$_GET["c_id"]; session_write_close(); header("location:$_SERVER[PHP_SELF]"); } //ลบ if(trim($_GET["action"]) == "Del") { $_SESSION["np_id"][$_GET[P]]=""; session_write_close(); header("location:$_SERVER[PHP_SELF]"); } ?> <BODY BACKGROUND="n.jpg" TEXT="black" LINK="blue" VLINK="black" ALINK="#FF0000"> <table width="770" border="1"> <td width="1%" valign="top"><?php require_once('menuleft.php'); ?></td> <td width="100%" valign="top"> <form action="" method="post" name="frmCart" id="frmCart"> <table width="100%"> <td><div align="center"> <strong>รายการจอง<input name="action" type="hidden" id="action" value="Update"></strong> </div></td> <tr> <td><table width="98%" border="1" align="center"> <tr> <td><div align="center">ลำดับ</div></td> <td><div align="center">ชื่ออุปกรณ์</div></td> <td><div align="center">รุ่น</div></td> <td><div align="center">ชนิด</div></td> <td><div align="center">ลบข้อมูล</div></td> </tr> <? $nNum=0; for($i=0;$i<=count($_SESSION["np_id"]);$i++) { $result=select("product","where p_id='".$_SESSION["np_id"]["$i"]."' "); $resulz=select("cat" ,"where c_id='".$_SESSION["nc_id"]["$i"]."' "); if($result) { $nNum++; ?> <td width="5%"><div align="center"> <?=$nNum;?> </div></td> <td width="30%"><?=$result["p_name"];?></td> <td width="30%"><?=$result["p_model"];?></td> <td width="20%"><?=$resulz["c_id"];?></td> <td width="15%"><div align="center"><a href="javascript:if(confirm('ลบรายการจองนี้')==true){window.location='<?=$_SERVER['PHP_SELF'];?>?action=Del&P=<?=$i;?>';}">ลบ</a></div></td> </tr> <? } } ?> </table> <br> <table width="98%" border="1" align="center"> <tr> <td width="85%"><div align="right">จำนวน</div></td> <td><div align="right"><?=$nNum;?></div></td> </tr> </table> <br> <tr> <td><div align="center"><?if($nNum==0){echo "<br><center><strong><font color=red>ไม่มีรายการจอง</font></strong></center><br><br>";}?> <input name="BtnContinute" type="button" class="button" value="จองเพิ่ม" onClick="window.location='index.php';"> <?if($nNum>0){?> <input name="Btncon" type="button" class="button" value="ต่อไป" onClick="window.location='con.php';"><?}?> </div></td> </tr> </table> </form>
SELECT product.*,cat.c_name As catName FROM product INNER join cat ON product.c_id =cat.c_id
<? function select($condition) { $sql = "SELECT product.*,cat.c_name As catName FROM product INNER join cat ON product.c_id =cat.c_id $condition"; $dbquery = mysql_query($sql);$result= mysql_fetch_array($dbquery); return $result; } $nNum=0; for($i=0;$i<=count($_SESSION["np_id"]);$i++) { $result=select("where p_id='".$_SESSION["np_id"]["$i"]."' "); if($result) { $nNum++; ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง