edit user

This commit is contained in:
Yasder5 2026-02-19 20:33:24 +01:00
parent 216de9c8df
commit 09ec39c7bb
11 changed files with 293 additions and 68 deletions

View file

@ -52,7 +52,7 @@
*/
public function insert(object $objUser):bool{
$strRq = "INSERT INTO users (user_name, user_firstname, user_pseudo, user_mail, user_password, user_phone, user_work, user_location, user_description)
$strRq = "INSERT INTO users (user_name, user_firstname, user_pseudo, user_mail, user_password, user_phone, user_work, user_location, user_description)
VALUES (:name, :firstname, :pseudo,:mail, :pwd, :phone, :work, :location,:description)";
$rqPrep = $this->_db->prepare($strRq);
@ -70,6 +70,35 @@
return $rqPrep->execute();
}
public function update(object $objUser):bool{
$strRq = "UPDATE users SET
user_name = :name,
user_firstname = :firstname,
user_pseudo = :pseudo,
user_mail = :mail,
user_phone = :phone,
user_work = :work,
user_location = :location,
user_description = :description
WHERE user_id = :id";
$rqPrep = $this->_db->prepare($strRq);
$rqPrep->bindValue(":id", $objUser->getId(), PDO::PARAM_INT);
$rqPrep->bindValue(":name", $objUser->getName(), PDO::PARAM_STR);
$rqPrep->bindValue(":firstname", $objUser->getFirstname(), PDO::PARAM_STR);
$rqPrep->bindValue(":pseudo", $objUser->getPseudo(), PDO::PARAM_STR);
$rqPrep->bindValue(":mail", $objUser->getMail(), PDO::PARAM_STR);
$rqPrep->bindValue(':phone', $objUser->getPhone() ?? "", PDO::PARAM_STR);
$rqPrep->bindValue(':work', $objUser->getWork() ?? "", PDO::PARAM_STR);
$rqPrep->bindValue(':location', $objUser->getLocation() ?? "", PDO::PARAM_STR);
$rqPrep->bindValue(':description', $objUser->getDescription() ?? "", PDO::PARAM_STR);
return $rqPrep->execute();
}
/**
* Fonction de vérification de mail
* @param string $mail