If the connection to database A fails, how can I connect to database B? What should I do without the trycatch method? NewPDO directly throws an exception if it fails and cannot proceed to the next step. Please help me !!!!!!!!!!!!! {Code...} How can I connect to database B if the connection to database A fails?
If try catch is not required, what should I do? If a failure occurs, new PDO directly throws an exception and cannot proceed to the next step. Please help me !!!!!!!!!!!!!
setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);} catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage();}?>
Reply content:
How can I connect to database B if database A fails?
If try catch is not required, what should I do? If a failure occurs, new PDO directly throws an exception and cannot proceed to the next step. Please help me !!!!!!!!!!!!!
setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);} catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage();}?>
Connect to catch and store exceptions in logs