mysql_ping()
bool mysql_ping([connection])Use this function to determine whether the current MySQL connection is still open. If it’s not open, the function attempts to reestablish the connection. If the connection is open or reopened, the function returns true. If the connection is not open and cannot be reestablished, it returns false. You may give an identifier to ping a different connection. Here is an example:
... $ping = mysql_ping($connection); print "Info: $ping \n"; ...
This function is available as of version 4.3 of PHP.