Reputation: 181
I want to know if using asynchronous HTTP request, using jquery and requesting a php file that connect to database you need to close mysqli_close($connection)
the connection after the query?
Upvotes: 1
Views: 179
Reputation: 1889
It's a good practice to do so, but when the request ends the database connection is released automatically, so I wouldn't worry about it.
As far as PHP cares an AJAX call is the same as any other, so the same rules apply to a standard page as do to AJAX calls.
Upvotes: 1
Reputation: 1655
PHP should automatically close connections and free any other resources, taken by script. But a good manner is to close connections explicitly.
Upvotes: 1