ajout pompier
This commit is contained in:
@@ -195,8 +195,6 @@ class PdoBD
|
||||
pCommentaire ='$commentaire', pDateModif ='$dateUpdate'
|
||||
WHERE pCis='$cis' AND pId = '$pId'
|
||||
;";
|
||||
var_dump($req);
|
||||
die;
|
||||
$rs = PdoBD::$monPdo->exec($req);
|
||||
if ($rs === false) {
|
||||
afficherErreurSQL("Probleme lors de la mise à jour du pompier dans la base de données.", $req, PdoBD::$monPdo->errorInfo());
|
||||
@@ -220,12 +218,19 @@ class PdoBD
|
||||
/**
|
||||
* ajoute une ligne dans la table pompier
|
||||
*/
|
||||
public function ajoutPompier($cis, $valeur, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire)
|
||||
public function ajoutPompier($cis, $id, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire)
|
||||
{
|
||||
$req = "INSERT INTO pompier
|
||||
(pCis,pId,pNom,pPrenom,pStatut,pMail,pLogin,pMdp,pGrade,pType, pAdresse,pCp,pVille,pBip,pCommentaire,pDateEnreg,pDateModif)
|
||||
(pCis,pId,pNom,pPrenom,pStatut,pMail,pLogin,pMdp,pGrade,pType, pAdresse,pCp,pVille,pBip,pCommentaire, pNbGardes, pDateEnreg, pDateModif)
|
||||
VALUES
|
||||
(
|
||||
(" . $cis . ", " . $id . ",
|
||||
'" . $nom . "', '" . $prenom . "',
|
||||
" . $statut . ", '" . $mail . "',
|
||||
'" . $login . "', '" . $mdp . "',
|
||||
" . $grade . ", " . $type . ",
|
||||
'" . $adresse . "', " . $cp . ",
|
||||
'" . $ville . "', '" . $tel . "',
|
||||
'" . $commentaire . "',0 ,CURRENT_DATE, CURRENT_DATE
|
||||
);";
|
||||
$rs = PdoBD::$monPdo->exec($req);
|
||||
if ($rs === false) {
|
||||
@@ -540,6 +545,32 @@ class PdoBD
|
||||
return $lesLignes;
|
||||
}
|
||||
|
||||
public function getLastId($pCis) : int
|
||||
{
|
||||
$req = "SELECT MAX(pId) + 1 as id FROM pompier WHERE pCis =" . $pCis . ";";
|
||||
$rs = PdoBD::$monPdo->query($req);
|
||||
if ($rs === false) {
|
||||
afficherErreurSQL("Erreur de lma requete pour l'id ajouter", $req, PdoBD::$monPdo->errorInfo());
|
||||
}
|
||||
$id = $rs->fetch();
|
||||
return $id["id"];
|
||||
}
|
||||
|
||||
public function verifDataAjoutPompier(
|
||||
string $nom,
|
||||
string $prenom,
|
||||
string $tel,
|
||||
string $mail,
|
||||
string $login
|
||||
) : bool {
|
||||
|
||||
if (empty($nom) || empty($prenom) || empty($tel) || empty($mail) || empty($login)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user