PHP mysqli_thread_id() function returns the thread ID for the current connection.
Syntax
object mysqli_thread_id(connection);
Parameter | Description |
---|---|
connection : | Required parameter. The MySQL connection to be used |
Return Values : | Returns a buffered result object or FALSE if an error occurred. |
<?php $con = mysqli_connect("localhost","user","password","db"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // Get thread id $thread_id = mysqli_thread_id($con); // Kill connection mysqli_kill($con, $thread_id); ?>