mysql_thread_id

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

mysql_thread_id

Post 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
User avatar
TheMoose
Forum Contributor
Posts: 351
Joined: Tue May 23, 2006 10:42 am

Post 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.
Post Reply