diff options
| author | Debulois <quentin@debulois.fr> | 2022-03-09 19:37:55 +0100 |
|---|---|---|
| committer | Debulois <quentin@debulois.fr> | 2022-03-09 19:37:55 +0100 |
| commit | 497ce42637ebaad0c388d309d6b5bbf91db2dfa4 (patch) | |
| tree | 45844b0ad0d03559eeecf0171efed745900478de /Database/meth_dbsearch.php | |
| parent | 5ddf8de3691fde866c5a48b440cffa2990b2014c (diff) | |
Mise à jour des fonctions de la bdd avec le nouveau modèle, renommage des fichier pour plus de clarte et ajout des documents et infos
Diffstat (limited to 'Database/meth_dbsearch.php')
| -rw-r--r-- | Database/meth_dbsearch.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Database/meth_dbsearch.php b/Database/meth_dbsearch.php index 0a325aa..a90925c 100644 --- a/Database/meth_dbsearch.php +++ b/Database/meth_dbsearch.php @@ -19,8 +19,8 @@ class DbSearch extends DbMain { // Récupération des infos d'un compte par son id final public function search_user_by_id($id) { - $reqSearchUser = "SELECT id, email, inscriptionDate, isAdmin, isUser, isConsultant - FROM ".$this->tableUserAccount." WHERE id = ?"; + $reqSearchUser = "SELECT userId, email, inscriptionDate, isClient, isPro, isAdmin + FROM ".$this->tableUserAccount." WHERE userId = ?"; $data = $this->exec_cmd($reqSearchUser, array($id))->fetch(PDO::FETCH_ASSOC); return $data; } @@ -37,10 +37,10 @@ class DbSearch extends DbMain { // Récupération des infos d'un consultant par son nom final public function search_consultant_by_name($research) { - $reqSearchConsultant = "SELECT id, lastname, firstname, job, capability FROM ".$this->tableUserInfo." + $reqSearchConsultant = "SELECT userId, lastname, firstname, job, capability FROM ".$this->tableUserInfo." INNER JOIN ".$this->tableUserAccount." - ON ".$this->tableUserInfo.".userId = ".$this->tableUserAccount.".id - WHERE isConsultant = '1' AND lastname LIKE CONCAT('%', ?, '%')"; + ON ".$this->tableUserInfo.".userId = ".$this->tableUserAccount.".userId + WHERE isPro = '1' AND lastname LIKE CONCAT('%', ?, '%')"; $data = $this->exec_cmd($reqSearchConsultant, array($research))->fetchAll(PDO::FETCH_ASSOC); return $data; } @@ -49,7 +49,7 @@ class DbSearch extends DbMain { final public function get_consultant_note_by_name($name) { $reqCountMission = "SELECT note FROM ".$this->tableMission." INNER JOIN ".$this->tableUserInfo." - ON ".$this->tableMission.".consultantId = ".$this->tableUserInfo.".userId + ON ".$this->tableMission.".proId = ".$this->tableUserInfo.".userId WHERE lastname = ?"; $data = $this->exec_cmd($reqCountMission, array($name))->fetchAll(PDO::FETCH_ASSOC); return $data; @@ -58,9 +58,9 @@ class DbSearch extends DbMain { // Récupérations des missions d'un consultant par son id final public function get_all_mission_by_id($id) { $reqGetAllMission = "SELECT subject, note, review, lastname FROM ".$this->tableMission." - INNER JOIN ".$this->tableUserInfo." - ON ".$this->tableMission.".userId = ".$this->tableUserInfo.".userId - WHERE consultantId = ?"; + LEFT JOIN ".$this->tableUserInfo." + ON ".$this->tableMission.".missionId = ".$this->tableUserInfo.".userId + WHERE proId = ?"; $data = $this->exec_cmd($reqGetAllMission, array($id))->fetchAll(PDO::FETCH_ASSOC); return $data; } @@ -69,7 +69,7 @@ class DbSearch extends DbMain { final public function count_consultant_mission_by_name($name) { $reqCountMission = "SELECT COUNT(*) FROM ".$this->tableMission." INNER JOIN ".$this->tableUserInfo." - ON ".$this->tableMission.".consultantId = ".$this->tableUserInfo.".userId + ON ".$this->tableMission.".proId = ".$this->tableUserInfo.".userId WHERE lastname = ?"; $data = $this->exec_cmd($reqCountMission, array($name))->fetchAll(PDO::FETCH_ASSOC); return $data; |
