'ok', 'err' => ''); try { if (empty($_POST) || empty($_POST["pa"])) throw new \Exception("parameter empty"); foreach ($_POST as $k => $v) { $$k = htmlspecialchars(stripslashes(trim($v))); } list($id, $total_price, $final_price, $finish_date) = explode("##", $pa); if (!$id || !$final_price || !$finish_date) throw new \Exception("parameter empty[2]"); $create_at = date("Y-m-d H:i:s"); $final_price = str_replace(",", "", $final_price); $sql = "update pricereview_repair_main set final_price = '$final_price', finish_date = '$finish_date', pstatus = 'B2', "; $sql .= "creater = '$user_id', create_at = '$create_at' where id = '$id'"; $res = mysqli_query($link, $sql); $affected = mysqli_affected_rows($link); if ($affected > 0) { $rarr['tp'] = $total_price; $rarr['fp'] = number_format($final_price); $rarr['fp'] = number_format($final_price); $rarr['fd'] = $finish_date; } else { $rarr['st'] = 'err'; $rarr['err'] = '無更新'; } }catch(\Exception $e) { $rarr['st'] = 'err'; $rarr['err'] = $e->getMessage(); } echo json_encode($rarr, JSON_UNESCAPED_UNICODE); exit; ?>