Added suggestion feature

This commit is contained in:
Florian Sylvain
2021-10-31 00:19:53 +02:00
parent 794f4094c9
commit 214ff958aa
5 changed files with 166 additions and 29 deletions
+23
View File
@@ -43,6 +43,29 @@ class dump {
return $theses_array;
}
public static function getAuthorsByAuthors(mixed $author_name) : array {
$array = [];
$author_name = '%' . $author_name . '%';
$pdo_obj = new conf();
$pdo = $pdo_obj->getPDO();
$stmt = $pdo->prepare("SELECT author FROM theses WHERE author LIKE :author_name LIMIT 10;");
$stmt->bindParam(':author_name', $author_name, PDO::PARAM_STR, 100);
$stmt->execute();
$i = 0;
while ($obj = $stmt->fetchObject()) {
foreach ($obj as $elem) {
array_push($array, $elem);
}
$i++;
}
return $array;
}
public function sendThese() {
$data = [
'author' => $this->these->getAuthor(),