diff options
Diffstat (limited to 'Database/meth_dbsearch.php')
| -rw-r--r-- | Database/meth_dbsearch.php | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/Database/meth_dbsearch.php b/Database/meth_dbsearch.php index eed9915..907301b 100644 --- a/Database/meth_dbsearch.php +++ b/Database/meth_dbsearch.php @@ -11,7 +11,7 @@ // https://www.freecodecamp.org/news/sql-joins-tutorial/ // Import de dbmain -require_once(dirname( __FILE__ )."./dbmain.php"); +require_once(dirname( __FILE__ )."/dbmain.php"); // Extension de cette classe avec dbmain class DbSearch extends DbMain { @@ -22,26 +22,26 @@ class DbSearch extends DbMain { // Récupération des infos d'un compte par son id final public function get_user_account_by_userid($userId) { $reqSearchUser = " - SELECT + SELECT userId, email, inscriptionDate, userStatus - FROM - ".$this->tableUserAccount." - WHERE + FROM + ".$this->tableUserAccount." + WHERE userId = ?"; $result = $this->exec_cmd($reqSearchUser, array($userId))->fetch(PDO::FETCH_ASSOC); return $result; } - + // Récupération des infos d'un utilisateur par son id final public function get_user_info_by_userid($userId) { $reqGetUserInfo = " - SELECT - userId, lastname, firstname, degree, + SELECT + userId, lastname, firstname, degree, capability, description, phoneNumber, - adress, zipCode, city - FROM - ".$this->tableUserInfo." - WHERE + adress, zipCode, city + FROM + ".$this->tableUserInfo." + WHERE userId = ?"; $result = $this->exec_cmd($reqGetUserInfo, array($userId))->fetchAll(PDO::FETCH_ASSOC); return $result; @@ -52,16 +52,16 @@ class DbSearch extends DbMain { // **************************************************************************** final public function get_all_pro_by_jobid($jobId) { $reqSearchConsultant = " - SELECT - ".$this->tableUserInfo.".userId, - lastname, firstname, capability - FROM + SELECT + ".$this->tableUserInfo.".userId, + lastname, firstname, capability + FROM ".$this->tableUserInfo." INNER JOIN ".$this->tableUserJob." ON ".$this->tableUserInfo.".userId = ".$this->tableUserJob.".userId - WHERE + WHERE jobCategoryId = ?"; $result = $this->exec_cmd($reqSearchConsultant, array($jobId))->fetchAll(PDO::FETCH_ASSOC); return $result; @@ -70,36 +70,36 @@ class DbSearch extends DbMain { // Récupération des infos d'un pro par son nom final public function get_pro_info_by_lastname($lastname) { $reqSearchConsultant = " - SELECT - ".$this->tableUserInfo.".userId, - lastname, firstname, capability - FROM + SELECT + ".$this->tableUserInfo.".userId, + lastname, firstname, capability + FROM ".$this->tableUserInfo." - INNER JOIN - ".$this->tableUserAccount." - ON + INNER JOIN + ".$this->tableUserAccount." + ON ".$this->tableUserInfo.".userId = ".$this->tableUserAccount.".userId - WHERE - userStatus = '1' - AND + WHERE + userStatus = '1' + AND lastname LIKE CONCAT('%', ?, '%')"; $result = $this->exec_cmd($reqSearchConsultant, array($lastname))->fetchAll(PDO::FETCH_ASSOC); return $result; } - + // Récupération des emploies associés à un pro final public function get_pro_job_by_proid($proId) { $reqGetAll = " - SELECT - ".$this->tableUserJob.".jobCategoryId, - jobCategoryNameEn, jobCategoryNameFr - FROM + SELECT + ".$this->tableUserJob.".jobCategoryId, + jobCategoryNameEn, jobCategoryNameFr + FROM ".$this->tableUserJob." - INNER JOIN + INNER JOIN ".$this->tableJobCategory." - ON + ON ".$this->tableUserJob.".jobCategoryId = ".$this->tableJobCategory.".jobCategoryId - WHERE + WHERE userId = ?"; $result = $this->exec_cmd($reqGetAll, array($proId))->fetchAll(PDO::FETCH_ASSOC); return $result; @@ -108,15 +108,15 @@ class DbSearch extends DbMain { // Récupération des notes d'un consultant par son nom final public function get_pro_note_by_proid($proId) { $reqCountMission = " - SELECT - note - FROM + SELECT + note + FROM ".$this->tableMission." - INNER JOIN - ".$this->tableUserInfo." - ON + INNER JOIN + ".$this->tableUserInfo." + ON ".$this->tableMission.".proId = ".$this->tableUserInfo.".userId - WHERE + WHERE proId = ?"; $result = $this->exec_cmd($reqCountMission, array($proId))->fetchAll(PDO::FETCH_NUM); return $result; @@ -128,9 +128,9 @@ class DbSearch extends DbMain { // Récupérer toutes les infos de la table jobCategory final public function get_job_all() { $reqGetAllJobs = " - SELECT - * - FROM + SELECT + * + FROM ".$this->tableJobCategory; $result = $this->exec_cmd($reqGetAllJobs, array())->fetchAll(PDO::FETCH_ASSOC); return $result; @@ -139,9 +139,9 @@ class DbSearch extends DbMain { // Récupérer toutes les infos de la table jobCategory final public function get_job_by_jobid($jobId) { $reqGetJobinfo = " - SELECT - * - FROM + SELECT + * + FROM ".$this->tableJobCategory." WHERE jobCategoryId = ?"; |
