I have my own database which I'm running using Xampp. I'm using the Apache and MySql services on it, though I given public access just yet. I would like to know the proper way to end a bunch of sql queries. I'm using ajax to send data to a php page and query some data from a server. During the ajax requests the I programmed the handler php page so it will be performing multiple queries (at least more than one) to get the specific data I need. Now, I don't know when in the process I should use mysqli_kill()
or mysqli_close()
. I have it set up right now so only after all the immediate queries for that particular ajax request have been performed, then run mysqli_close(). I don't even use mysqli_kill(). I don't know too much about database connections or managing performance on a server so I don't know how to consider this. On one hand, I don't need to close the connection until that user logs off the webpage, right? Or should I just open and close each connection as it comes and is processed?
This handler php page processes requests from a few webpages I have and in one of the webpages there is an input box that sends ajax requests every keystroke to show hints (possible matches)... also note this is an employee access only page so connections shouldn't be too high.
I also took a look at this post Could someone explain a little about this statement about mysqli close function?
The answer is contradictory to the suggestion taken from the php manual website. Would someone please clarify when to use mysqli_kill()
and mysqli_close()
as well if, for the circumstances I described, there would be any reason to keep a connection alive for the sake of performance?