<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-874" /> <title>Update product's data</title> <style type="text/css"> <!-- .style2 {font-size: 18px; font-weight: bold; } --> </style> </head> <body> <? require ("config.php"); require ("function.php"); if($_GET["Action"]=="Delete") { $sql_del= "delete from nutritionfact where ProductID='".$_GET["ProductID"]."'"; $dbquery_del = mysql_query($sql_del); echo"<script language='JavaScript'>"; echo"alert('ลบข้อมูลเรียบร้อยแล้ว');"; echo"window.location='update_admin.php';"; echo"</script>"; } include "head.php"; ?> <table width=1366> <tr><td width=266 bgcolor=#F0FFF0 valign=top> <ul> <li><a href=adddata_admin.php><h3>Add product's data</h3></a></li> <li><a href=update_admin.php><h3>Edit-Delete product's data</h3></a></li> <li><a href=loadad_admin.php><h3>Add product's date</h3></a></li> <li><a href=loadde_admin.php><h3>Delete</h3></a></li> <li><a href=homepage.php><h3>Homepage</h3></a></li> <li><a href=logout.php><h3>Log out</h3></a></li> </ul> </td> <td width=1200 bgcolor=#C1FFC1> <table border="1" width="100%"> <tr><td width="10%"><div align="center" class="style2">Product's ID</div></td> <td width="10%"><div align="center" class="style2">Product's Name</div></td> <td width="10%"><div align="center" class="style2">Serving_Size</div></td> <td width="10%"><div align="center" class="style2">Times</div></td> <td width="10%"><div align="center" class="style2">Energy</div></td> <td width="10%"><div align="center" class="style2">Sugars</div></td> <td width="10%"><div align="center" class="style2">Total_Fat</div></td> <td width="10%"><div align="center" class="style2">Sodium</div></td> <td width="10%"><div align="center" class="style2">Picture</div></td> <td><div align="center" class="style2">Edit</div></td> <td><div align="center" class="style2">Delete</div></td> </tr> <? $sql_stock = "select ProductID, ProductName, Serving_Size, Times, Energy, Sugars, Total_Fat, Sodium, Fig from nutritionfact"; $dbquery_stock = mysql_query($sql_stock); $num_rows_stock = mysql_num_rows($dbquery_stock); while ($result = mysql_fetch_array($dbquery_stock)) { $ProductID = $result["ProductID"]; $productname = $result["ProductName"]; $serving = $result["Serving_Size"]; $times = $result["Times"]; $energy = $result["Energy"]; $sugar = $result["Sugars"]; $total = $result["Total_Fat"]; $sodium = $result["Sodium"]; $fig = $result["Fig"]; echo "<tr align='center'>"; echo "<td>$ProductID</td><td>$productname</td><td>$serving</td><td>$times</td><td>$energy</td><td>$sugar</td><td>$total</td><td>$sodium</td><td><img src='$fig'></td>"; ?> <script language="javascript"> function Conf<?=$result["ProductID"]; ?>(object) { if (confirm("ยืนยันการลบ [ <?=$result["ProductName"]; ?> ] ") ==true) { return true; } return false; } </script> <td><div align="center"><a href="update.php?ProductID=<?=$result["ProductID"];?>"><img src="../nutrition/sign/edit.png" height="20" border="0"></a></div></td> <td width="21"><div align="center"><a href="<?=$_SERVER['PHP_SELF'];?>?Action=Delete&ProductID=<?=$result["ProductID"];?>&file1=<?=$result["PictureSmall"];?>&file2=<?=$result["PictureBig"];?>" onClick="return Conf<?=$result["ProductID"]; ?>(this)"><img src="../nutrition/sign/delete.jpg" height="20" border="0"></a></div></td> </tr> <? } ?> </table></table> </body> </html>
if($_GET["Action"]=="Delete") { $sql_del= "delete from nutritionfact where ProductID='".$_GET["ProductID"]."'"; $dbquery_del = mysql_query($sql_del) or die(mysql_error()); echo $sql_del; exit(); echo"<script language='JavaScript'>"; echo"alert('ลบข้อมูลเรียบร้อยแล้ว');"; echo"window.location='update_admin.php';"; echo"</script>"; }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง