I tried to insert the data and also update the data in 2 different table. so I tried this code
$query = "INSERT INTO mitra (id_user, puas_1, puas_2)
values (?,?,?);
UPDATE user
SET fill = 1
WHERE id = '".$id_session."';";
$stmt = $connection->prepare($query);
$stmt->bind_param("idd", $id_session, $puas1, $puas2);
$stmt->execute();
if ($stmt->affected_rows) {
echo "Uploaded " . $stmt->affected_rows . " rows";
// header("Location: umum.php");
} else {
echo "No rows matched the criteria.";
}
$stmt->close();
but it says that Uncaught mysqli_sql_exception: You have an error in your SQL syntax; near update etc. is there anything to make it work please?
$mysqli->multi_query()which is not recommended. You need to run PDO statements twiceWHERE id = '".$id_session."';";