diff --git a/Source/API/script/Gateway/GatewayForm.php b/Source/API/script/Gateway/GatewayForm.php index 400f98d..3a57011 100644 --- a/Source/API/script/Gateway/GatewayForm.php +++ b/Source/API/script/Gateway/GatewayForm.php @@ -2,7 +2,7 @@ namespace API\script\Gateway; -use API\script\Config\Connection; +use Config\Connection; use BusinessClass\Form; use BusinessClass\Question; use PDO; diff --git a/Source/Config/Connection.php b/Source/Config/Connection.php new file mode 100644 index 0000000..1279874 --- /dev/null +++ b/Source/Config/Connection.php @@ -0,0 +1,54 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + } + + + /** + * Éxécute une réquête SQL. + * + * @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(); + } + + + /** + * Permet de récupère le résultat de la dernière réquête éxecuté avec + * la fonction executeQuery(). + * + * @return array + */ + public function getResults(): array + { + return $this->stmt->fetchAll(); + + } +} \ No newline at end of file diff --git a/Source/Config/config.php b/Source/Config/config.php index 21511d2..42befc6 100644 --- a/Source/Config/config.php +++ b/Source/Config/config.php @@ -1,6 +1,8 @@ getForm(); + $html = (new ModelCandidate())->getForm(); require_once($rep.$views['form']); }