php - Close mysqli database connections after AJAX calls -


html>

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.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -