How to get the thread ID for the current MySQLi connection in PHP

1 Answer

0 votes
$db_host        = 'localhost';
$db_user        = 'root';
$db_password    = '';
$db_name        = 'allonpage';
  
$con = new mysqli('localhost', $db_user, $db_password, $db_name);
  
if ($con->connect_error) 
    die('Connection Error: ' . $con->server_info);
  
$thread_id = $con->thread_id;
echo $thread_id;
                                   
$con->close();
 
/*
run: 

4263
 
*/

 



answered Jul 12, 2016 by avibootz
...