Im 'getting this warning "access to the resource is not yet allowed" when trying to close the mysqli connection. Why?
$mysqli = new mysqli ( $database ["dbUri"], $database ["dbUserName"], $database ["dbPassword"], $database ["dbSchema"], $database ["dbPort"] ); $mysqli->autocommit(FALSE); $con = $mysqli; $rowsAffected = ; if ($rowsAffected==0) { throw new Exception("Insert of new record failed"); } $insertId = $con->insert_id; $con->commit(); $con->close();
By the way, the insert was successful, and I have the correct value in $ insertId. Commit works well, but it's close, which triggers a warning.
I hid the code in the /* completes insert using $con */ section /* completes insert using $con */ , since it is long and irrelevant (sql works). Therefore, if you do not think this is relevant, I have included the rest.
I looked at similar questions, but other posts refer to a connection that is not established. However, my connection works. PLEASE see the paragraph "Insert successfully."
php mysqli warnings
NEW2WEB
source share