conn = null; try { $this->conn = new PDO( "mysql:host=" . $this->host . ";dbname=" . $this->dbname, $this->user, $this->password ); $this->conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $this->conn->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $exception) { echo "Connection errro" . $exception->getMessage(); } return $this->conn; } };