Forum und email

mysql_thread_id

(PHP 4 >= 4.3.0, PHP 5, PECL mysql:1.0)

mysql_thread_id — Return the current thread ID

Popis

int mysql_thread_id ([ resource $link_identifier ] )

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.

Parametre

link_identifier

Pripojenie k MySQL. Ak link identifier nie je zadaný, predpokladá sa posledné spojenie otvorené s mysql_connect(). Ak také spojenie nie je nájdené, pokúsi sa jedno vytvoriť ako keby bolo volané mysql_connect() bez argumentov. Ak sa náhodou nájde pripojenie, alebo je vytvorené, je vygenerované varovanie úrovne E_WARNING.

Vrátené hodnoty

The thread ID on success, or FALSE on failure.

Príklady

Example#1 mysql_thread_id() example

<?php
$link 
mysql_connect('localhost''mysql_user''mysql_password');
$thread_id mysql_thread_id($link);
if (
$thread_id){
    
printf("current thread id is %d\n"$thread_id);
}
?>

Výstup horeuvedeného príkladu bude niečo podobné tomuto:

current thread id is 73