conn = null; try { // $this->conn = mysqli_connect($this->db_hostname, $this->db_username, // $this->db_password, $this->db_database) or $error=1; $this->conn = new PDO('mysql:host='.$this->db_hostname.';dbname='.$this->db_database, $this->db_username, $this->db_password); $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $ex) { die("Hubo un error. No se pudo conectar a la base de datos: ".$ex->getMessage()); } // mysqli_set_charset($this->conn,"utf8"); return $this->conn; } } ?>