PHP mysqli_kill() Function

PHP mysqli_kill() function kills MySQL server thread mentioned by processid.

Syntax

bool mysqli_kill(connection, processid);

mysqli_kill() Function Parameter

ParameterDescription
connection :Required parameter. The MySQL connection to be used
processid :Required parameter. The thread ID returned from mysqli_thread_id()

mysqli_kill() Function Return Value

Return Values :Returns TRUE on success or FALSE on failure.

mysqli_kill() Function Example

<?php
$con = mysqli_init();

if (!mysqli_real_connect($con,"localhost","user","password","db"))
{
  die("Connection Error: " . mysqli_connect_error());
}
$thread_id = mysqli_thread_id($con);

// kill connection by threadid
mysqli_kill($con, $thread_id);

mysqli_close($con);
?>