Advertisement
Guest User

Untitled

a guest
Mar 27th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <?php
  2. ini_set('display_errors', 1); // om errors te zien
  3. error_reporting(E_ALL|E_STRICT);
  4. class Port{ // hier maak een andere class aan voor mijn diary
  5. private function connect() {
  6.  
  7. $servername = "localhost";
  8. $username = "root";
  9. $password = "";
  10.  
  11. try {
  12. $conn = new PDO("mysql:host=$servername;dbname=portoftroy", $username, $password);
  13. // set the PDO error mode to exception
  14. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  15. return $conn;
  16. }
  17. catch(PDOException $e)
  18. {
  19. return $e->getMessage();
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement