SHARE
TWEET

Untitled

a guest Nov 16th, 2019 133 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $servername = "db"; //I'm not sure what I've to put here /service name(db) or IP of the container?
  3. $username = "php";
  4. $password = "php";
  5.  
  6. try {
  7.     $conn = new PDO("mysql:host=$servername;dbname=myDB", $username, $password);
  8.     // set the PDO error mode to exception
  9.     $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  10.     echo "Connected successfully";
  11.     }
  12. catch(PDOException $e)
  13.     {
  14.     echo "Connection failed: " . $e->getMessage();
  15.     }
  16. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top