Small question: php syntax to close database-connection with prepared statements (and placeholders) [duplicate]

1 day ago 3
ARTICLE AD BOX

I have read upon prepared statements and have ajax-prep-stmt.php with

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = new mysqli("localhost","","",""); $mysqli->set_charset("utf8mb4"); $stmt = $mysqli->prepare("UPDATE `-notes` SET name=?, content=?, tags=? WHERE unique_hak=?"); $stmt->bind_param("ssss", $name, $content, $tags, $unique); $stmt->execute(); //fetching result would go here, but will be covered later $result = $stmt->get_result(); $stmt->close();

Everything is working.

Question: $stmt->close() seems to 'close' the (prepared) statement.

Do I still have to close the connection to the database? I might be confusion 'objects' with 'procedures'. In the new code there is no $conn = mysqli_connect so don't think I need mysqli_close($conn); anymore. I need to be sure though because I had trouble before by not always closing my connections.

Read Entire Article