From 9d70e4cead6b0b39d8df94da6f3cfd7cecb2e495 Mon Sep 17 00:00:00 2001 From: Victortunes Date: Fri, 27 Oct 2023 10:47:20 +0200 Subject: [PATCH] ADD: config BDD + vues --- project/src/config/config.php | 22 +++++++++++++++++++++ project/src/index.php | 12 +++--------- project/src/model/Connection.php | 33 ++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 project/src/config/config.php create mode 100644 project/src/model/Connection.php diff --git a/project/src/config/config.php b/project/src/config/config.php new file mode 100644 index 0000000..2641e16 --- /dev/null +++ b/project/src/config/config.php @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/project/src/index.php b/project/src/index.php index 521985c..1f878eb 100644 --- a/project/src/index.php +++ b/project/src/index.php @@ -4,16 +4,10 @@ test setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +} + + +/** * @param string $query + * @param array $parameters * + * @return bool Returns `true` on success, `false` otherwise +*/ + +public function executeQuery(string $query, array $parameters = []) : bool{ + $this->stmt = parent::prepare($query); + foreach ($parameters as $name => $value) { + $this->stmt->bindValue($name, $value[0], $value[1]); + } + + return $this->stmt->execute(); +} + +public function getResults() : array { + return $this->stmt->fetchall(); + +} +} + +?>