“检查帖子是否已设置”> “检查帖子是否设定” “检查帖子是否设置”> “检查帖子是否设定” `````````````````````````
if (isset($_POST['submit'])) {
//variables
$date = escape_string($_POST['date']);
$po_num = empty($_POST['po_num']) ? 0 : escape_string($_POST['po_num']);
$po_date = escape_string($_POST['po_date']);
$d_date = escape_string($_POST['d_date']);
$job_code = empty($_POST['job_code']) ? 0 : escape_string($_POST['job_code']);
$job_name = escape_string($_POST['job_name']);
$customer_name = escape_string($_POST['customer_name']);
$qty = empty($_POST['qty']) ? 0 : escape_string($_POST['qty']);
$prt_type = escape_string($_POST['prt_type']);
$prt_as_per = escape_string($_POST['prt_as_per']);
$cylinder_brand = escape_string($_POST['cylinder_brand']);
$cylinder_len = empty($_POST['cylinder_len']) ? 0 : escape_string($_POST['cylinder_len']);
$cylinder_circum = empty($_POST['cylinder_circum']) ? 0 : escape_string($_POST['cylinder_circum']);
$no_ups = empty($_POST['no_ups']) ? 0 : escape_string($_POST['no_ups']);
$no_repeat = empty($_POST['no_repeat']) ? 0 : escape_string($_POST['no_repeat']);
$prt_mm = empty($_POST['prt_mm']) ? 0 : escape_string($_POST['prt_mm']);
$prt_mic = empty($_POST['prt_mic']) ? 0 : escape_string($_POST['prt_mic']);
$prt_wt = empty($_POST['prt_wt']) ? 0 : escape_string($_POST['prt_wt']);
$lm1_mm = empty($_POST['lm1_mm']) ? 0 : escape_string($_POST['lm1_mm']);
$lm1_mic = empty($_POST['lm1_mic']) ? 0 : escape_string($_POST['lm1_mic']);
$lm1_wt = empty($_POST['lm1_wt']) ? 0 : escape_string($_POST['lm1_wt']);
$lm2_mm = empty($_POST['lm2_mm']) ? 0 : escape_string($_POST['lm2_mm']);
$lm2_mic = empty($_POST['lm2_mic']) ? 0 : escape_string($_POST['lm2_mic']);
$lm2_wt = empty($_POST['lm2_wt']) ? 0 : escape_string($_POST['lm2_wt']);
$lm3_mm = empty($_POST['lm3_mm']) ? 0 : escape_string($_POST['lm3_mm']);
$lm3_mic = empty($_POST['lm3_mic']) ? 0 : escape_string($_POST['lm3_mic']);
$lm3_wt = empty($_POST['lm3_wt']) ? 0 : escape_string($_POST['lm3_wt']);
$slt_mm = empty($_POST['slt_mm']) ? 0 : escape_string($_POST['slt_mm']);
$slt_len = empty($_POST['slt_len']) ? 0 : escape_string($_POST['slt_len']);
$slt_direction = escape_string($_POST['slt_direction']);
$ink_series = escape_string($_POST['ink_series']);
$no_ink = empty($_POST['no_ink']) ? 0 : escape_string($_POST['no_ink']);
$bm_qty = empty($_POST['bm_qty']) ? 0 : escape_string($_POST['bm_qty']);
$bm_size = escape_string($_POST['bm_size']);
$bm_type = escape_string($_POST['bm_type']);
$cnt_per = escape_string($_POST['cnt_per']);
$add = escape_string($_POST['add']);
$coq_req = escape_string($_POST['coq_req']);
$ds_dc = escape_string($_POST['ds_dc']);
$com_rep = escape_string($_POST['com_rep']);
$remarks = escape_string($_POST['remarks']);
//准备查询
$query = "INSERT INTO job_order(
po_num,
del_date,
po_date,
job_code,
job_name,
customer_name,
qty,
prt_type,
prt_as_per,
having_change,
cylinder_len,
cylinder_circum,
no_ups,
no_repeat,
prt_mm,
prt_u,
prt_wt,
lm1_mm,
lm1_u,
lm1_wt,
lm2_mm,
lm2_u,
lm2_wt,
lm3_mm,
lm3_u,
lm3_wt,
slt_width,
slt_cut,
slt_direction,
ink_series,
no_ink,
bm_qty,
bm_size,
bm_type,
ds_cont_person,
ds_add,
/*ds_coa,*/
ds_dc,
ds_com_rep,
ds_remarks) VALUES (
'$po_num',
'$d_date',
'$po_date',
'$job_code',
'$job_name',
'$customer_name',
'$qty',
'$prt_type',
'$prt_as_per',
'$cylinder_brand',
'$cylinder_len',
'$cylinder_circum',
'$no_ups',
'$no_repeat',
'$prt_mm',
'$prt_mic',
'$prt_wt',
'$lm1_mm',
'$lm1_mic',
'$lm1_wt',
'$lm2_mm',
'$lm2_mic',
'$lm2_wt',
'$lm3_mm',
'$lm3_mic',
'$lm3_wt',
'$slt_mm',
'$slt_len',
'$slt_direction',
'$ink_series',
'$no_ink',
'$bm_qty',
'$bm_size',
'$bm_type',
'$cnt_per',
'$add',
/*'$coq_req',*/
'$ds_dc',
'$com_rep',
'$remarks'
)";
// exicute查询到mysql
$result = mysqli_query($connection,$query);
confirm_query($result);
if ($result) {
$_SESSION['msg'] = "Added New Job Order Successfully.";
redirect_to('index.php');
}else{
echo "Sorry there were some problem.";
}
}
这是完整的PHP代码,请检查并找出错误...
答案 0 :(得分:1)
说,从查询中移除;
,'$remarks';
。我觉得你的查询会运行,由于将终结符放在错误的位置,你会遇到这个问题。
答案 1 :(得分:1)
我可能不会猜到你和你的代码有什么问题,但是我想建议你使用alternet语法这样写一个很长的查询更有意义。
"INSERT INTO table_name SET
column_name = $value,
column_name = $value,
column_name = $value,
column_name = $value,
column_name = $value,
column_name = $value";
答案 2 :(得分:0)
$query = "INSERT INTO job_order( po_num, del_date, po_date, job_code, job_name, customer_name, qty, prt_type, prt_as_per, having_change, cylinder_len, cylinder_circum, no_ups, no_repeat, prt_mm, prt_u, prt_wt, lm1_mm, lm1_u, lm1_wt, lm2_mm, lm2_u, lm2_wt, lm3_mm, lm3_u, lm3_wt, slt_width, slt_cut, slt_direction, ink_series, no_ink, bm_qty, bm_size, bm_type, ds_cont_person, ds_add, ds_coa, ds_dc, ds_com_rep, ds_remarks) VALUES ( '$po_num', '$d_date', '$po_date', '$job_code', '$job_name', '$customer_name', '$qty', '$prt_type', '$prt_as_per', '$cylinder_brand', '$cylinder_len', '$cylinder_circum', '$no_ups', '$no_repeat', '$prt_mm', '$prt_mic', '$prt_wt', '$lm1_mm', '$lm1_mic', '$lm1_wt', '$lm2_mm', '$lm2_mic', '$lm2_wt', '$lm3_mm', '$lm3_mic', '$lm3_wt', '$slt_mm', '$slt_len', '$slt_direction', '$ink_series', '$no_ink', '$bm_qty', '$bm_size', '$bm_type', '$cnt_per', '$add', '$coq_req', '$ds_dc', '$com_rep', '$remarks' )";