Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. $user='root';
  2. $password='root';
  3. $database='emotiondb';
  4. $pdo=null;
  5. try {
  6. $pdo = new PDO("mysql:host=localhost;dbname$database", $user, $password);
  7. $pdo->setAttribute(PDO::ATTR_ERRMODE,
  8. PDO::ERRMODE_EXCEPTION);
  9. echo 'Connected to database';
  10. }catch (PDOException $e)
  11. {
  12. print 'Exception!: ' . $e->getMessage();
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement