mysqli::kill
(mysqli_kill) Requires the server to terminate the MySQL thread
The kill()
/ mysqli_kill()
function requests the server to terminate the MySQL thread specified by the processid parameter.
Return the thread ID of the current connection and terminate the connection:
<?php $mysqli = new mysqli ( "localhost" , "my_user" , "my_password" , "my_db" ) ; if ( $mysqli -> connect_errno ) { echo "Failed to connect to MySQL: " . $mysqli -> connect_error ; exit ( ) ; } // Get the thread ID $t_id = $mysqli -> thread_id ; // Terminate the connection $mysqli -> kill ( $t_id ) ; $mysqli -> close ( ) ; ?>
Return the thread ID of the current connection and terminate the connection:
<?php $con = mysqli_connect ( "localhost" , "my_user" , "my_password" , "my_db" ) ; if ( mysqli_connect_errno ( ) ) { echo "Failed to connect to MySQL: " . mysqli_connect_error ( ) ; exit ( ) ; } // Get the thread ID $t_id = mysqli_thread_id ( $con ) ; // Terminate the connection mysqli_kill ( $con , $t_id ) ; mysqli_close ( $con ) ; ?>