Fetching table using mysqli, closing statement before displaying results
As soon as you are finished using your $stmt object, it is practical to close it.

However, I find that I am never calling $stmt-&gt;close(); in any of my projects because php is going to trash them as soon as my script is done anyhow.

Technically, you could have called it one line earlier.

Some leisure reading:


$stmt->close() vs $stmt->free_result()
When to close Prepared Statement
PHP - close prepared stmt
When is the right time to close a prepared statement?