I've tried the code below but it didn't work:
if (isset($_POST['ubah'])) {
$queryUpdate = mysqli_multi_query("INSERT INTO perbaikan SET id_perbaikan = '',idrusakbaik = '" . $id . "',komenrusak = '" . $_POST['komenrusak'] . "',tglbaik = '" . $tgl_sekarang . "'; UPDATE kerusakan SET status = '" . $_POST['status'] . "'WHERE id_kerusakan = '" . $id . "'");
if ($queryUpdate) {
echo "<script> alert('Data Berhasil Disimpan'); location.href='index.php?hal=master/perbaikan-mekanik/list' </script>";
exit;
}
}
There is no such thing as "two queries in one query". There are always two queries. and there is not a single reason to run them in one call. therefore just rewrite your query to two prepared statements
$sql = "INSERT INTO perbaikan SET id_perbaikan = '',idrusakbaik = ?,komenrusak = ?,tglbaik = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("sss", $id, $_POST['komenrusak'],$tgl_sekarang);
$stmt->execute();
$sql = "UPDATE kerusakan SET status = ? WHERE id_kerusakan = ?");
$stmt = $conn->prepare($sql);
$stmt->bind_param("ss", $_POST['status'], $id);
$stmt->execute();