Edit file File name : class.A2OptPDO.php Content :<?php class A2OptPDO extends PDO { public $engine; public $host; public $database; public $user; public $pass; public function __construct($host, $user, $pass, $db_name) { $this->engine = 'mysql'; $this->host = $host; $this->database = $db_name; $this->user = $user; $this->pass = $pass; if (!empty($this->host) && !empty($this->database) && !empty($this->user) && !empty($this->pass)) { $dns = "{$this->engine}:dbname={$this->database};host={$this->host}"; try { parent::__construct($dns, $this->user, $this->pass); } catch (PDOException $exception) { throw $exception; } } else { throw new PDOException('Missing parameters.'); } } } Save