foreach($_POST["qty"] as $key => $value) { if($value != '') { if($_POST['code'][$key] != '') { $codeq = $_POST['code'][$key]; } if($_POST['name'][$key] != '') { $nameq = $_POST['name'][$key]; } if($_POST['price'][$key] != '') { $priceq = $_POST['price'][$key]; } if($_POST['qty'][$key] != '') { $qtyq = $_POST['qty'][$key]; } $sqlp = "select * from products where p_code ='$codeq'"; $queryp = mysql_query($sqlp) or die("error=$sqlp"); $rowp = mysql_fetch_array($queryp); $un_id = $rowp['un_id']; if($un_id == '2') { $qty2 += $qtyq; if(($priceq >= '150')and($qtyq >= '1')and($qtyq <= '50')) { if(($qty2 >= '1') and ($qty2 <='50')) { $sqlt = "select * from type where t_id ='2'"; $queryt = mysql_query($sqlt) or die("error=$sqlt"); $rowt = mysql_fetch_array($queryt); $com = $rowt['t_com']; $sumt3 = ($qty2*$com)*10; } } else if(($priceq >= '140')and($priceq <= '149')and($qtyq >= '51')and($qtyq <= '100')) { if(($qty2 >= '51') and ($qty2 <='100')) { $sqlt = "select * from type where t_id ='3'"; $queryt = mysql_query($sqlt) or die("error=$sqlt"); $rowt = mysql_fetch_array($queryt); $com = $rowt['t_com']; $sumt3 = ($qty2*$com)*10; } } else if(($priceq >= '130')and($priceq <= '139')and($qtyq > '100')) { if($qty2 > '100') { $sqlt = "select * from type where t_id ='4'"; $queryt = mysql_query($sqlt) or die("error=$sqlt"); $rowt = mysql_fetch_array($queryt); $com = $rowt['t_com']; $sumt3 = ($qty2*$com)*10; } } else { exit("<script>alert('ระบุราคาและจำนวนไม่ตรงตามเงื่อนไข !');history.back();</script>"); } } $sql2 = "insert into quotation_detail values (null,'$codeq','$nameq','$priceq','$qtyq','$q_id')"; $query2 = mysql_query($sql2); }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง