Check out example codes for "how to get the id of the inserted row in mysqli". It will help you in understanding the concepts better.

Code Example 1

if ($conn->query($sql) === TRUE) {
    $last_id = $conn->insert_id;
    echo "New record created successfully. Last inserted ID is: " . $last_id;
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}

Learn ReactJs, React Native from akashmittal.com