Evaluating text section answer accuracy This code is from a flex app and is the PHP to determine if a user has read a section of text and answered a question correctly.

I write to a table that is similar to a bookmark, and then update the users points. This code works, but since I am making two calls to the database I am worried that it is too "expensive". I tried a few things like using a subquery (maybe I just don't know the syntax). I am using this for now, but I just want to do as well as I can.

public function createReadSectionAndPnts($userId, $item){
  $stmt = mysqli_prepare($this-&gt;connection,
"INSERT INTO readSection (
        user_id, chapter_id, section_letter, section_id, sub_section
        ) 
    VALUES (?, ?, ?, ?, ?)");
$this-&gt;throwExceptionOnError();

mysqli_bind_param($stmt, 'iisss', $userId, $item-&gt;chapter_id, $item-&gt;section_letter,
$item-&gt;section_id, $item-&gt;sub_section);
$this-&gt;throwExceptionOnError();

mysqli_stmt_execute($stmt);
$this-&gt;throwExceptionOnError();

$autoid = mysqli_stmt_insert_id($stmt);

mysqli_stmt_free_result($stmt);

$stmt2 = mysqli_prepare($this-&gt;connection,
"UPDATE users SET total_points = (5 + total_points)  WHERE id =?");
    $this-&gt;throwExceptionOnError();

    mysqli_bind_param($stmt2, 'i', $userId);
    $this-&gt;throwExceptionOnError();

    mysqli_stmt_execute($stmt2);
    $this-&gt;throwExceptionOnError();

    mysqli_stmt_free_result($stmt2);
    mysqli_close($this-&gt;connection);


return $autoid;
}
Sorry. You need to use two statement since you are updating two different tables.