HubsInfo Network
You're browsing our forum as a Guest meaning you can only see a portion of the forum in read-only mode. To view all forum nodes and be able to create threads/posts please register or log-in.
PHP MySQL Linux Material Design Web Hosting Online Games SimCity BuildIt

PHP try/catch and fatal error when mysql is down!

0 Members and 1 Guest are viewing this topic.

PHP try/catch and fatal error when mysql is down!
« 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!");
 



Linux Ubuntu Guides Linux games - Lutris.net