You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
772 B
36 lines
772 B
<?php
|
|
|
|
namespace App\Gateway;
|
|
|
|
use PDO;
|
|
use App\Connexion;
|
|
|
|
/**
|
|
* A sample gateway, that stores the sample form's result.
|
|
*/
|
|
class FormResultGateway {
|
|
private Connexion $con;
|
|
|
|
public function __construct(Connexion $con) {
|
|
$this->con = $con;
|
|
}
|
|
|
|
|
|
public function insert(string $username, string $description): void {
|
|
$this->con->exec(
|
|
"INSERT INTO FormEntries VALUES (:name, :description)",
|
|
[
|
|
":name" => [$username, PDO::PARAM_STR],
|
|
"description" => [$description, PDO::PARAM_STR],
|
|
]
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function listResults(): array {
|
|
return $this->con->fetch("SELECT * FROM FormEntries", []);
|
|
}
|
|
}
|