MySQLi - Property Access Not Yet Allowed

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 = /* completes insert using $con */; 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."

+2
php mysqli warnings
source share
1 answer

As far as my analysis of this intermittent problem has completed (at least in my case), this is some kind of error in the mysqli extension or the PHP debugger (XDebug), since this only happens when I break the point / single-run program, but not when you simply run the same code without interrupting / pressing any code once until the page is finished rendering.

Does this happen to you if you are not interrupting or executing any code before the page has finished rendering?

+1
source share

All Articles