Return the thread ID of the current connection, then kill the connection:
<?php$con=mysqli_connect("localhost","my_user","my_password","my_db");//Detect connection if (mysqli_connect_errno($con)) { echo "Failed to connect to MySQL: " . mysqli_connect_error( ); }//Get thread ID$t_id=mysqli_thread_id($con);// Kill the thread mysqli_kill($con,$t_id);?>The mysqli_kill() function requests the server to kill a MySQL thread specified by the processid parameter.
mysqli_kill( connection,processid ) ;
| parameter | describe |
|---|---|
| connection | Required. Specifies the MySQL connection to use. |
| processid | Required. The thread ID returned by mysqli_thread_id(). |
| Return value: | Returns TRUE if successful and FALSE if failed. |
|---|---|
| PHP version: | 5+ |