diff options
Diffstat (limited to 'Database/meth_dbsearch.php')
| -rw-r--r-- | Database/meth_dbsearch.php | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/Database/meth_dbsearch.php b/Database/meth_dbsearch.php index 8a95a67..5104d15 100644 --- a/Database/meth_dbsearch.php +++ b/Database/meth_dbsearch.php @@ -5,7 +5,7 @@ // **************************************************************************** // Infos pour les "join": // https://www.freecodecamp.org/news/sql-joins-tutorial/ -// + // Import de dbmain require_once(dirname( __FILE__ )."/dbmain.php"); // Extension de cette classe avec dbmain @@ -15,8 +15,8 @@ class DbSearch extends DbMain { final public function get_user_account_by_id($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; + $result = $this->exec_cmd($reqSearchUser, array($id))->fetch(PDO::FETCH_ASSOC); + return $result; } // Récupération des infos d'un utilisateur par son id @@ -25,8 +25,8 @@ class DbSearch extends DbMain { capability, description, phoneNumber, adress, zipCode, city FROM ".$this->tableUserInfo." WHERE userId = ?"; - $data = $this->exec_cmd($reqGetUserInfo, array($id))->fetchAll(PDO::FETCH_ASSOC); - return $data; + $result = $this->exec_cmd($reqGetUserInfo, array($id))->fetchAll(PDO::FETCH_ASSOC); + return $result; } // Récupération des infos d'un pro par son nom @@ -36,19 +36,36 @@ class DbSearch extends DbMain { INNER JOIN ".$this->tableUserAccount." 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; + $result = $this->exec_cmd($reqSearchConsultant, array($research))->fetchAll(PDO::FETCH_ASSOC); + return $result; } + // Récupération des emploies associés à un pro + final public function get_pro_job_category($id) { + $reqGetAll = "SELECT jobCategoryId FROM ".$this->tableUserJob." WHERE userId = ?"; + $result = $this->exec_cmd($reqGetAll, array($id))->fetchAll(PDO::FETCH_NUM); + $proJobs = []; + for ($i = 0; $i < count($result); $i++) { + array_push($proJobs, $result[$i][0]); + } + return $proJobs; + } + // Récupération des notes d'un consultant par son nom final public function get_pro_note_by_lastname($name) { $reqCountMission = "SELECT note FROM ".$this->tableMission." INNER JOIN ".$this->tableUserInfo." ON ".$this->tableMission.".proId = ".$this->tableUserInfo.".userId WHERE lastname = ?"; - $data = $this->exec_cmd($reqCountMission, array($name))->fetchAll(PDO::FETCH_ASSOC); - return $data; + $result = $this->exec_cmd($reqCountMission, array($name))->fetchAll(PDO::FETCH_ASSOC); + return $result; } + // Récupérer toutes les infos de la table jobCategory + final public function get_job_category_all() { + $reqGetAll = "SELECT * FROM ".$this->tableJobCategory; + $result = $this->exec_cmd($reqGetAll, array())->fetchAll(PDO::FETCH_ASSOC); + return $result; + } } ?>
\ No newline at end of file |
