setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); }catch (\PDOException $e){ throw new Exception("PDO error con"); } catch (Error $e){ throw new Error("Error PDO"); } } /** * @param string $query to execute * @param array $parameters to bind * @return bool Returns `true` on success, `false` otherwise * @throws Exception */ public function executeQuery(string $query, array $parameters = []): bool { try{ $this->stmt = parent::prepare($query); foreach ($parameters as $name => $value) { $this->stmt->bindValue($name, $value[0], $value[1]); } return $this->stmt->execute(); }catch (\PDOException $e){ throw new Exception("PDO error"); } } /** * @return array */ public function getResults(): array { return $this->stmt->fetchall(); } }