Page 1 of 1

mysql_thread_id

Posted: Tue Jul 24, 2007 8:36 am
by anjanesh
Hi

Im creating a class where I log to a file mysql operations like connect, query and close.
This is to track down errors and misplaced data.

There not much info on mysql_thread_id($dblink), but it looks like this returns the process thread id upon opening a mysql connection until its lost or closed.

So how many ever queries I execute after opening a connection, this therad-id (of $dblink) will remain the same till the end of the script right - (or till the connection ends) ?

Thanks

Posted: Tue Jul 24, 2007 8:53 am
by TheMoose
http://us2.php.net/mysql_thread_id

"Retrieves the current thread ID. If the connection is lost, and a reconnect with mysql_ping() is executed, the thread ID will change. This means only retrieve the thread ID when needed."

As long as the connection remains open through a single connection request, it will stay the same. If the connection ever drops and you reconnect, it changes.