Search the Community
Showing results for tags 'close database free results'.
I've never been clear about when these two functions need to be called and (if they are never called) when $dbc is closed automatically and when the result of a query is "freed" automatically. My example is this: I have a php page that has a form. The first thing that is done is to fill it in with default data from the database via a SELECT. From here, the data can be edited and then saved. 1. Should I "mysqli_close($dbc);" AFTER the "Select" query and BEFORE the form is validated and then "UPDATED" or is it okay to leave it alone and just close it after the form has been "UPDATED"? And what about "free_Result". Should this always be done along with the "close" function or does it only matter according to how mach data is being read from the DB? 2. Is the database closed and the result freed when a different .php page is accessed? I've never run into trouble doing or not doing these but I think I'd like to know the SOP. thanks