Example 1 — Read the Thread ID
Fixed demo printing a sample thread id.
<?php
$threadId = 42; // stand-in for mysqli_thread_id($link)
echo 'thread_id=', $threadId, PHP_EOL; How It Works
- Connect to MySQL.
- Call mysqli_thread_id($link) or read $mysqli->thread_id.
- Print or log the integer if you need it.
- Sample output when connected to a demo database shows the real session id.

