<?php include("header.php"); ?> <table width=800 cellspacing=1 cellpadding=3 bgcolor=#DDFFDD align=center style="border: solid 1px green;"> <tr> <td> <?php $cust_id = $_GET['cid']; include("../dbconn.inc.php"); $sql = "SELECT *, DATE_FORMAT(order_date,'%d-%m-%Y') AS dt FROM customer WHERE cust_id = $cust_id;"; $result = mysql_query($sql); $cust = mysql_fetch_array($result); echo "<td><td><td><td></br><b>รหัสลูกค้า:</b> {$cust['cust_id']} <br /> <b>ชื่อลูกค้า:</b> {$cust['name']} <br /> <b>ที่อยู่:</b> {$cust['address']} <br /> <b>เบอร์โทร:</b> {$cust['phone']} <br /> <b>อีเมล์:</b> {$cust['email']} <br /> <b>วันที่สั่งซื้อ:</b> {$cust['dt']} </br>"; echo "<form name=\"form2\" method=\"post\" action=\"orderst_insert.php\"> </br><b>สถานะการสั่งซื้อ:</b> {$cust['order_status']} <br /> <select name=\"order_status\" id=\"order_status\"> <option>รอการชำระเงิน</option> <option>ชำระเงินเรียบร้อย/รอรับสินค้า</option> <input type=\"submit\" name=\"button\" id=\"button\" value=\"บันทึก\"> </br></br> </form>"; echo "</br><b>ชื่อผู้รับสินค้า:</b> {$cust['name2']} <br /> <b>ที่อยู่ผู้รับสินค้า:</b> {$cust['address2']} <br /><br />"; echo "<b>รายละเอียดการ์ด:</b> {$cust['card_detail']} <br />"; $sql = "SELECT * FROM orders WHERE cust_id = $cust_id;"; $result = mysql_query($sql); ?> <center> <table border="1" cellpadding="5" bordercolor="green" style="border-collapse: collapse;"> <tr bgcolor="#DDFFDD"> <th width="50">ลำดับ</th><th width="250">รายการ</th> <th width="60">จำนวน</th><th width="80">ราคา</th><th width="80">รวม</th> </tr> <?php $i = 0; $gt = 0; while($ord = mysql_fetch_array($result)) { $st = $ord['price'] * $ord['quantity']; $gt += $st; $i++; echo "<tr> <td align=center> $i </td> <td> {$ord['pro_name']} </td> <td align=center> {$ord['quantity']} </td> <td align=center> {$ord['price']} </td> <td align=right> $st </td> </tr>"; } ?> <tr align=center> <td colspan=4 align="right"><b>รวมทั้งหมด</b></td> <td align=right><u><?php echo $gt; ?></u></td></br></br> </tr> </tr></td> </table></br></br></br></br> </table></center> <?php include("footer.php"); ?> </body> </html>
<?php include("header.php"); ?> <?php $hostname="localhost"; $user="root"; $password="1234"; $dbname="karaket"; $tblname="customer"; mysql_connect($hostname,$user,$password)or die ("ติดต่อฐานข้อมูลไม่ได้"); mysql_query("SET NAMES utf8"); mysql_select_db($dbname)or die("เลือกฐานข้อมูลไม่ได้"); //สร้างตัวแปรว่างๆเอาไว้ก่อน เพื่อรอจัดเก็บข้อมูลในขั้นตอนต่อไป $order_status = ""; $order_status = $_POST['order_status']; $cust_id = $_GET['cid']; //จัดเก็บข้อมูลลูกค้าจัดเก็บลงในตาราง customer $sql = "UPDATE customer SET order_status='$order_status' WHERE cust_id=cust_id"; @mysql_query($sql) or die(mysql_error()); ?> <? echo"<table width=800 cellspacing=1 cellpadding=3 bgcolor=#DDFFDD align=center style=\"border: solid 1px green;\"><tr><td>"; echo"<center><h2>ข้อมูลได้ถูกบันทึกเรียบร้อยแล้ว</h2></br></center></br></br></br></br></br>"; echo"</tr></td></table>"; ?> <? echo "<meta http-equiv=refresh content=4;URL=order_list.php>"; //echo "<BR><BR><CENTER>ERROR! ไม่สามารถบันทึกข้อมูลได้ กรุณารอสักครู่"; // echo "<meta http-equiv=refresh content=4;URL=order_list.php>"; ?> <?php include("footer.php"); ?> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง