| 1234567891011121314151617181920212223 |
- <?php
- class Database {
- private $host = '10.15.10.8';
- private $db_name = 'inventory_db';
- private $username = 'inventory_db';
- private $password = 'fNk@6P[!cTK)wgkO';
- public $conn;
- public function getConnection() {
- $this->conn = null;
- try {
- $this->conn = new PDO("mysql:host=" . $this->host . ";dbname=" . $this->db_name, $this->username, $this->password);
- $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $this->conn->exec("set names utf8");
- } catch(PDOException $exception) {
- echo "Connection error: " . $exception->getMessage();
- }
- return $this->conn;
- }
- }
- ?>
|