connection = null; try{ $this->connection = new PDO("mysql:host=" . $this->db_host . ";dbname=" . $this->db_name, $this->db_user, $this->db_password); }catch(PDOException $exception){ echo "Connection failed: " . $exception->getMessage(); } return $this->connection; } } ?>