check connection error in php code example
Example 1: check network connection php
$response = null;
system("ping -c 1 google.com", $response);
if($response == 0)
{
// this means you are connected
}
Example 2: mysqli connect error
<?php
$conn=mysqli_connect("localhost","username","password","database_name");
?>
This code will connect with database 'database_name' while $conn is connection name