|
|
|
สอบถาม บันทึกข้อมูล ซ้ำ ได้ 2 บิล เปลี่ยนแต่ เลข รัน อย่างอื่นเหมือนกันหมด |
|
|
|
|
|
|
|
เกิดจากสาเหตุอะไร ครับ บันทึกข้อมูลได้ปกติ เป็นบางครั้ง นานๆเป็นที ที่เกิด บิลเบิ้ล รายการทุกอย่างเหมือนกันหมด
ยกเว้น เลขที่รัน s_num_run ตัวนี้
-หน้า กรอกข้อมูล ได้ทำให้ ปุ่ม submit กดได้ครั้งเดียวแล้วครับ
หรือมีสคริปอะไร ทำให้ซ้ำเกิดขึ้น
ตัวอย่างโค๊ดหน้าบันทึกครับ
ไฟล์ input_tester.php
---------------------------------------------------
Code (PHP)
<?php
session_start();
include "session_pb.php";
include("config.php");
include('fnalert.php');
include('datetimepicking.php');
$sele="SELECT MAX(s_num_run) AS s_num FROM `input_stock_1` ";
$dbquery_=mysql_query($sele);
$rowss=mysql_fetch_array($dbquery_);
$stock_num_run=sprintf("%04d",$C+1);
// input non type array-------------------------------------------------------------------------------------------------
$stock_date=$_POST['stock_date'];
$signup=$stock_date; // 2013-11-05
$singup_ar_=explode("-",$signup);
$singup_ar_new="$singup_ar_[2]-$singup_ar_[1]-$singup_ar_[0]";// 05-11-2013
$Condition_date=$_POST['Condition_date'];
$day=$Condition_date;// 30 day
$singup_ar=explode("-",$singup_ar_new);
$c_s=mktime(0,0,0,$singup_ar[1],$singup_ar[0]+$day,$singup_ar[2]);
$pay=date("Y-m-d",$c_s);//บวกกันแล้ว ได้ผลลัพธ์ 2013-12-05
$pay_cut=explode("-",$pay);
$Condition_due_date="$pay_cut[0]-$pay_cut[1]-$pay_cut[2]";
$Condition_due_date; // 2013-11-05
$name=$_POST['name'];
$idmem=$_POST['idmem'];
$member_id=$_POST['member_id'];
$adate=$_POST['adate'];
$status_up=$_POST['status_up'];
$stock_name=$_POST['stock_name'];
$sum_vat_post=$_POST['sum_vat'];
$sum_vat = str_replace(',', '', $sum_vat_post);
$sum_not_vat=$_POST['sum_not_vat'];
$order_pledge=$_POST['order_pledge'];
$color_order=$_POST['color_order'];
$discount_order=$_POST['discount_order'];
$color_order_name=$_POST['color_order_name'];
// input array type------------------------------------------------------------------------------------------------------------------
$stock_order_ID=$_POST['order_ID'];
$Po_No=$_POST['Po_No'];
$Salesman=$_POST['Salesman'];
foreach($_POST['stock_order_ID'] as $key => $stock_order_ID){
if(($_POST['stock_order_member_send'][0]=="") && ($_POST['stock_order_member_send'][1]=="") && ($_POST['stock_order_member_send'][2]=="") && ($_POST['stock_order_member_send'][3]=="")){
al("Send number !!");
redi3("test1.php");
}elseif(($_POST['stock_price'][0]=="") && ($_POST['stock_price'][1]=="") && ($_POST['stock_price'][2]=="") && ($_POST['stock_price'][3]=="")){
al("Price number !!");
redi3("test1.php");
}else{
if(($_POST['stock_order_member_rest'][$key]<>"") && ($_POST['stock_order_member_send'][$key]<>"")){
$sum_sum_front[$key]=$_POST['stock_order_member_rest'][$key] - $_POST['stock_order_member_send'][$key];
$storefront_input_id=$_POST['storefront_input_id'][$key];
//update_storefront_input-----------------------------------------------------------------------------------------------------------
$sqq_up="update `store_in` SET storefront_input_num='$sum_sum_front[$key]' WHERE storefront_input_id='$storefront_input_id'";
$qu_up=mysql_query($sqq_up);
//}
//update_storefront------------------------------------------------------------------------------------------------------------------
$id_front=$_POST['id_front'][$key];
$sum_member_rest_front[$key]=$_POST['member_rest_front'][$key] - $_POST['stock_order_member_send'][$key];
$update_input_stock="UPDATE `store_` SET member_rest_front='$sum_member_rest_front[$key]'
WHERE id_front='$id_front' ";
$quer_ur=mysql_query($update_input_stock);
//update_order -------------------------------------------------------------------------------------------------------------------------
$update_order="UPDATE `input_order_in` SET member_rest='{$_POST['stock_order_member_rest'][$key]}', member_send='{$_POST['stock_order_member_send'][$key]}'
WHERE order_ID='$stock_order_ID' ";
$quer=mysql_query($update_order);
$stock_order_generation = mysql_real_escape_string($_POST['stock_order_generation'][$key]);
//input--------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>
$insert="INSERT IGNORE INTO `input_stock_1` (stock_id,stock_date,stock_num_run,stock_name,stock_order_ID,id_front,stock_order_generation,stock_order_size,stock_order_member, stock_order_member_rest, stock_order_member_send , stock_price, stock_price_sum,stock_idcode_pb,sum_vat,sum_not_vat,Discount,Po_No,Condition_date,Condition_due_date,Salesman,order_pledge,color_order,discount_order,color_order_name,stock_detail_tax,name,idmem,member_id,adate, status_up,storefront_input_id)
VALUES ('','$stock_date' , '$stock_num_run' , '$stock_name' , '$stock_order_ID','{$_POST['id_front'][$key]}' ,'$stock_order_generation', '{$_POST['stock_order_size'][$key]}' , '{$_POST['stock_order_member_rest'][$key]}', '{$sum_sum_front[$key]}' , '{$_POST['stock_order_member_send'][$key]}' , '{$_POST['stock_price'][$key]}', '{$_POST['stock_price_sum'][$key]}','{$_POST['stock_idcode_pb'][$key]}' ,'$sum_vat','$sum_not_vat','{$_POST['Discount'][$key]}','$Po_No','$Condition_date','$Condition_due_date','$Salesman','$order_pledge','$color_order','$discount_order'
,'$color_order_name' , '{$_POST['stock_detail_tax'][$key]}' ,'$name' , '$idmem' , '$member_id' , '$adate' , '$status_up','{$_POST['storefront_input_id'][$key]}')";
$result=mysql_query($insert);
if($result){
mysql_query("COMMIT");
al("success!!");
redi3("ront_test.php");
}else{
echo mysql_error();
mysql_query("ROLLBACK");
al("not success!!");
redi3("javascript:history:back();");
}
}
}
}
//------------------------------------------------->>>>>>>>>>>>>>>>>>>>
$delcheck="delete FROM `input_stock_1` WHERE stock_order_generation=' '";
$qu=mysql_query($delcheck);
?>
Tag : PHP, MySQL, HTML/CSS, Action Script, Ajax, jQuery
|
ประวัติการแก้ไข 2017-02-28 11:35:40 2017-02-28 13:14:55
|
|
|
|
|
Date :
2017-02-28 11:34:57 |
By :
sawmon |
View :
638 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|