<?php include("connDB.php"); $result = mysql_query("select * from listfood WHERE listfood_id LIKE '1000%' order by listfood_id"); while($dbarr = mysql_fetch_array($result)) { ?> <tr> <td width="5%" bgcolor="#CCCCFF" align="center"><?php echo $dbarr['listfood_id'] ; ?></td> <td width="20%" bgcolor="#CCCCFF" align="center"><?php echo $dbarr['listfood_name'] ; ?></td> <td width="5%" bgcolor="#CCCCFF" align="center"><center><a href="100001edit.php?id=<?=$dbarr['listfood_id'];?>">แก้ไข</a></center></td> <td width="5%" bgcolor="#CCCCFF" align="center"><center><a href="100001delete.php?id=<?=$dbarr['listfood_id'];?>" OnClick="return Conf(this)">ลบ</a></center></td> </tr> </td> <?php } ?>
<form action="100001add_in.php" method="post" onSubmit="return checkform(this);"> <p> </p> <table width="490" border="1"> <tr> <td colspan="2" align="center" bgcolor="#CC0000"><label><span class="style11">เพิ่มรายการอาหาร</span></label></td> </tr> <tr> <td width="111" align="center"><strong>รหัสอาหาร</strong></td> <td width="369"><label> <input name="listfood_id" type="text" size="30" style="width: 150px" maxlength="8"> </label></td> </tr> <tr> <td align="center"><strong>รายการอาหาร</strong></td> <td><label> <input name="listfood_name" type="text" size="30" style="width: 150px" maxlength="80"> </label></td> </tr> <tr> <td colspan="2" align="center"><label></label> <input type="submit" name="submit" id="submit" value="บันทึก"> <input name="cancle" type="submit" id="cancle" value="ยกเลิก"></td> </tr> </table> </form>
<?php include("connDB.php"); $listfood_id = $_POST['listfood_id']; $listfood_name = $_POST['listfood_name']; $result = mysql_query("INSERT INTO listfood (listfood_id,listfood_name) VALUES ('$listfood_id','$listfood_name')"); if($result) { echo "<center>เพิ่มข้อมูลสำเร็จ<br><br><< <a href=\"index1.php\">ตกลง</a> >></center>"; } else { echo "<center>เพิ่มข้อมูลไม่สำเร็จ<br><br><< <a href=\"index1.php\">ตกลง</a> >></center>"; } ?>
<?php include "connDB.php"; $listfood_id = $_GET['listfood_id']; $listfood_name=$_GET['listfood_name']; $result = mysql_query("select * from listfood where listfood_id='$listfood_id'"); $dbarr = mysql_fetch_array($result) ; ?>
<?php include "connDB.php"; $listfood_id = $_POST['listfood_id']; $listfood_name = $_POST['listfood_name']; $sql="UPDATE listfood_id='$listfood_id' , listfood_name='$listfood_name' WHERE listfood_id = '$listfood_id'"; $result = mysql_query($sql); if($result) { echo "<center> <table border=\"1\" > <tr> <center> แก้ไขข้อมูลสำเร็จ<br><br> <font size=\"4\"><a href=\"index.php\">กลับหน้าหลัก</a></font> </center> </td> </tr> </table> </center>"; } else { echo "<center> <table border=\"1\"> <tr> <td height=\"136\" bgcolor=\"#FFCCFF\"> <center> การแก้ไขข้อมูลล้มเหลว !!<br><br> <font size=\"4\"><a href=\"100001edit.php\">กลับ</a></font> </center> </td> </tr> </table> </center>"; } ?>
<? include "connDB.php"; $listfood_id = $_GET['listfood_id']; $sql = "delete from listfood where listfood_id=$listfood_id"; $result = mysql_query($sql); if($result) { echo "<center> <table border=\"1\" > <tr> <td height=\"136\"> <center> ลบข้อมูลเรียบร้อยแล้ว <br><br> <font size=\"4\"><a href=\"100001show.php\">ตกลง</a></font> </center> </td> </tr> </table> </center>"; } else { echo "<center> <table border=\"1\" > <tr> <td height=\"136\" bgcolor=\"#FFCCFF\"> <center> <font size=\"5\" color=\"#000080\">การลบล้มเหลว !!</font><br><br> <font size=\"4\"><a href=\"100001show.php\">กลับ</a></font> </center> </td> </tr> </table> </center>"; } ?> <a href="food_database.php?id=<?=$dbarr['listfood_id'];?>">เรียกดูข้อมูลในฐานข้อมูล</a></center>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง