Guest User

Untitled

a guest
Oct 23rd, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. class connex {
  2. public static $bdd;
  3. const USERNAME="root";
  4. const PASSWORD="root";
  5. const HOST="localhost";
  6. const DB="forum";
  7. public function connexion() {
  8. try {
  9. $username = self::USERNAME;
  10. $password = self::PASSWORD;
  11. $host = self::HOST;
  12. $db = self::DB;
  13. $bdd = new PDO("mysql:dbname=$db;host=$host", $username, $password);
  14.  
  15. }catch (PDOException $e){
  16. print "Erreur, " . $e->getMessage() . "<br />";
  17. die();
  18. }
  19. return true;
  20. }
  21.  
  22. public function deconnexion() {
  23. $bdd = null;
  24. return true;
  25. }
Add Comment
Please, Sign In to add comment