SHARE
TWEET

DbConnect.php

michussj07 Dec 28th, 2018 7 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: Michał
  5.  * Date: 2018-12-28
  6.  * Time: 18:04
  7.  */
  8.  
  9. class DbConnect {
  10.     private $host = 'localhost';
  11.     private $dbName = 'fcm-push';
  12.     private $user = 'root';
  13.     private $pass = '';
  14.  
  15.     public function connect()
  16.     {
  17.         try {
  18.             $conn = new PDO('mysql:hots=' . $this->host . '; dbname=' . $this
  19.                     ->dbName, $this->user, $this->pass);
  20.             $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  21.             return $conn;
  22.  
  23.         } catch (PDOException $e) {
  24.             echo 'Database Error: ' . $e->getMessage();
  25.             }
  26.     }
  27. }
  28.  
  29.  
  30. ?>
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
 
Top