(PHP 4 >= 4.3.0, PHP 5)mysql_ping -- Ping a server connection or reconnect if there is no connection
Checks 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.
The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments. If by chance no connection is found or established, an E_WARNING level warning is generated.
Returns TRUE if the connection to the server MySQL server is working, otherwise FALSE.
Example 1. A mysql_ping() example