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

Descrierea

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.

Parametri

link_identifier

Conexiunea MySQL. Dacă identificatorul legăturii nu este specificat, se presupune că este ultima legătură deschisă cu ajutorul mysql_connect(). Dacă nu este găsită nici o astfel de legătură, se va încerca crearea uneia prin apelul mysql_connect() fără argumente. În caz că nici o conexiune nu este găsită sau stabilită, se va genera o avertizare de nivelul E_WARNING.

Valorile întroarse

The thread ID on success, or FALSE on failure.

Exemple

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);
}
?>

Exemplul de mai sus va afişa ceva similar cu:

current thread id is 73

Vedeţi de asemenea