HubsInfo Network

General discussions => Servers and Networking [IT & Datacenter] => PHP => Topic started by: Remix on September 20, 2016, 11:25:56 PM

Title: PHP try/catch and fatal error when mysql is down!
Post by: Remix on September 20, 2016, 11:25:56 PM
Code: [Select]
try{
   $db = new PDO('mysql:host='.$host.';port='.$port.';dbname='.$db, $user, $pass, $options);
}

Code: [Select]
$db = new PDO('mysql:host='.$host.';port='.$port.';dbname='.$db, $user, $pass, $options) or die("Cannot Create PDO!");
Code: [Select]
$db = new PDO('mysql:host='.$host.';port='.$port.';dbname='.$db, $user, $pass, $options) or ($GLOBALS['errors'][] = "Cannot Create PDO!");