I am handling my AJAX calls in an ajax.php database using the mysqli_connect () function Connection establishes and right of connection by using the mysqli_close () function before resonance and exiting.
Even so, connections seem to be open, after a certain number of AJAX calls, I am getting 'several connections' error.
So now I am thinking, what is the best way to ensure that all my DB connections are closed after each call? Is there any way to check how many connections are currently open to troubleshoot this problem?
ajax.php:
$ con = mysqli_connect ("localhost", "my_user", "my_password", "my_db"); // .. some PHP code ... 'Result' echo; Mysqli_close ($ thief); Go out();
this can help you:
$ Connection = new mysqli (.....) // stuff $ thread = $ connection- & gt; Thread_id; $ Connection & gt; ($ Thread) to kill;
From:
This function is used to ask the server to kill a MySQL thread specified by the processed parameter. This value must be retrieved by calling the mysqli_thread_id () function.