Query: mysql_ping
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
MYSQL_PING(3) 1 MYSQL_PING(3) mysql_ping - Ping a server connection or reconnect if there is no connectionSYNOPSISWarning This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include: omysqli_ping(3) bool mysql_ping ([resource $link_identifier = NULL])DESCRIPTIONChecks whether or not the connection to the server is working. If it has gone down, an automatic reconnection is attempted. This function can be used by scripts that remain idle for a long while, to check whether or not the server has closed the connection and reconnect if necessary. Note Automatic reconnection is disabled by default in versions of MySQL >= 5.0.3. o $ link_identifier -The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect(3) is assumed. If no such link is found, it will try to create one as if mysql_connect(3) was called with no arguments. If no connection is found or established, an E_WARNING level error is generated. Returns TRUE if the connection to the server MySQL server is working, otherwise FALSE. Example #1 A mysql_ping(3) example <?php set_time_limit(0); $conn = mysql_connect('localhost', 'mysqluser', 'mypass'); $db = mysql_select_db('mydb'); /* Assuming this query will take a long time */ $result = mysql_query($sql); if (!$result) { echo 'Query #1 failed, exiting.'; exit; } /* Make sure the connection is still alive, if not, try to reconnect */ if (!mysql_ping($conn)) { echo 'Lost connection, exiting after query #1'; exit; } mysql_free_result($result); /* So the connection is still alive, let's run another query */ $result2 = mysql_query($sql2); ?> mysql_thread_id(3), mysql_list_processes(3). PHP Documentation Group MYSQL_PING(3)
Related Man Pages |
---|
mysql_query(3) - php |
mysql_errno(3) - php |
mysql_list_tables(3) - php |
mysql_create_db(3) - php |
mysql_stat(3) - php |
Similar Topics in the Unix Linux Community |
---|
Webserver Setup, need help! |
Lost+Found is not available |
DB connection and query |
Php server globals REQUEST_URI or HTTP_SERVER_VARS |
UNIX string connection to sql server db |