From cae5faec06ea35d4b007c42cbf314cfcd2d3303c Mon Sep 17 00:00:00 2001 From: ycharbi Date: Tue, 18 Jan 2022 22:49:28 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20d'un=20bogue=20sur=20la=20fonction?= =?UTF-8?q?=20retournant=20le=20domaine=20par=20d=C3=A9faut=20->=20gestion?= =?UTF-8?q?=20du=20cas=20o=C3=B9=20il=20n'y=20en=20a=20pas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/fonctions/bdd/domaines.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/services/fonctions/bdd/domaines.php b/services/fonctions/bdd/domaines.php index 795e577..5f4294c 100644 --- a/services/fonctions/bdd/domaines.php +++ b/services/fonctions/bdd/domaines.php @@ -34,8 +34,17 @@ function retourneDomaineDefautPostfix($pdo) { $sql=$pdo->prepare($req); $sql->execute(); - $domaine_defaut = $sql->fetchAll(); - return $domaine_defaut[0]['domaine']; + $result = $sql ->fetchAll(PDO::FETCH_ASSOC); + $comptage = count($result); + + if($comptage == 1){ + $domaine_defaut = $result; + return $domaine_defaut[0]['domaine'];; + } + else { + $domaine_defaut = ""; + return $domaine_defaut; + } } catch (\Exception $e) { die ("Erreur de requĂȘte de selection des domaines pour \"$base\" : ".$e->getMessage());