( [resource link_identifier] )
mysql_thread_id() returns the current thread ID. If the connection is lost and you reconnect with mysql_ping(), the thread ID will change. This means you should not get the thread ID and store it for later. You should get it when you need it.
Example 1. mysql_thread_id() example
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$thread_id = mysql_thread_id($link);
printf("current thread id is %d\n", $thread_id);
The above example would produce the following output:
See also mysql_ping() and mysql_list_processes().