I am trying to update 2 tables via one form, the form submits to the parts table and then takes the id from the parts inserted record and creates an entry into job_parts table.
i have tried several option from various forums but not had any luck so far, my code is below along with DB structure.
Update: code edited as suggested but only posting data to 'parts' table and not too 'job_parts table'
tables: !(https://drive.google.com/file/d/11I9HZrjc834_Ft5rqZoa0uFoJyDmMWGL/view?usp=sharing)
if(isset($_POST['submitpart']))
{
    $job_id = $_POST['job_id'];
    $partName = $_POST['partName'];
    $partCost = $_POST['partCost'];
    $partRetail = $_POST['partRetail'];
    $partQuantity = $_POST['partQuantity'];
    $sql1 = "INSERT INTO parts (part_name, part_cost, part_rrp) VALUES ('$partName', '$partCost', '$partRetail');";
    $sql1 .= "SET @last_id_parts = LAST_INSERT_ID();";
    $sql1 .= "INSERT INTO job_parts (job_id, part_id, quantity) VALUES ('$job_id', @last_id_parts, '$partQuantity')";
    $outcome = mysqli_multi_query($conn, $sql1);
    if ($outcome) {
        do {
            // grab the result of the next query
            if (($outcome = mysqli_store_result($mysqli)) === false && 
 mysqli_error($mysqli) != '') {
                echo "Query failed: " . mysqli_error($mysqli);
            }
        } while (mysqli_more_results($mysqli) && 
 mysqli_next_result($mysqli)); // while there are more results
    } else {
        echo "First query failed..." . mysqli_error($mysqli);
    }
}
 
     
     
    