PHP mysqli_kill()Functions
Examples
Returns the thread ID of the current connection, then kills the connection:
<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// Check 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);
?>
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// Check 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);
?>
Definition and Usage
The mysqli_kill() function requests the server to kill aprocessidMySQL thread specified by the parameter.
Syntax
mysqli_kill(connection,processid);
| Parameters | Description |
|---|---|
| connection | Required. Specifies the MySQL connection to use. |
| processid | Required. Bymysqli_thread_id()the returned thread ID. |
Technical Details
| Return value: | Returns TRUE on success, or FALSE on failure. |
|---|---|
| PHP Version: | 5+ |
PHP MySQLi Reference Manual Other Extensions