Advertisement
jroakes

Untitled

Apr 27th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1. try {
  2.  
  3.     $db = mysqli_connect(db_hostname, db_user, db_password, db_base);
  4.  
  5.     if (!$db) {
  6.         echo "Error: Unable to connect to MySQLi." . PHP_EOL;
  7.         echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
  8.         echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
  9.         exit;
  10.     } else {
  11.        
  12.         define("db_dsn", $db );
  13.    
  14.     }
  15.    
  16.    
  17. } catch (Exception $e) {
  18.  
  19.     echo 'Caught exception: ',  $e->getMessage(), "\n";
  20.    
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement