mysql_ping

(PHP 4 >= 4.3.0, PHP 5)

mysql_ping -- Проверяет соединение с сервером и пересоединяется при необходимости

Описание

bool mysql_ping ( [resource link_identifier] )

mysql_ping() проверяет соединение с сервером. Если оно утеряно, автоматически предпринимается попытка пересоединения. Эта функция может быть использована в скриптах, работающих на протяжении долгого времени. mysql_ping() возвращает TRUE, если соединение в рабочем состоянии и FALSE в противном случае.

См. также mysql_thread_id() и mysql_list_processes().



mysql_ping
cybot2000 at yahoo dot de
25-May-2005 04:44
It should be noted that mysql_ping() seems to reset the error message on the server.
I used it to check whether the connection was still alive before reading the error message via mysql_error() and it always returned an empty string. Upon removing the connection check everything worked.
vinicius at teracom dot com dot br
16-Mar-2004 07:35
Is important to remember that if your first connection to mysql don't works, mysql_ping will always return true! So, if you want to check if mysql is connected, first of all you must check if mysql_connect do not returns false and then you can begin to check mysql_ping.

<mysql_pconnectmysql_query>
 Last updated: Tue, 15 Nov 2005