Advertisement
Guest User

PDO Database connection

a guest
Jan 12th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. $dbname = "testing";
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5.  
  6. try {
  7. $db = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
  8. } catch (PDOException $e) {
  9. die ('Unable to connect to database : '.$e->getMessage());
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement