Checking whether the internet connection is still alive using mysql
        by guruprasad[ Edit ] 2014-05-20 10:25:32 
         
        
        	To Check whether the internet connection is available while executing mysql queries
Function to be used in mysql:
mysql_ping(); //parameter will be the mysql_connect config properties.
Example:
$dbconn=mysql_connect('localhost','username','password');
if (mysql_ping ($conn))
{
    echo "connection is available";
}
else
{
   echo "connection is not available";
}
Note:
when internet connection is not available or breaks while queries executing,its better to close the mysql connection and restart again to set the mysql connection properly.
Example:
if (!mysql_ping ($conn)) {
   mysql_close($conn);
  $dbconn=mysql_connect('localhost','username','password');
   mysql_select_db('db',$dbconn);
}